removed unnecessary handlebars page routes
This commit is contained in:
parent
0e88bb4c60
commit
bfa623ec17
2 changed files with 3 additions and 27 deletions
|
@ -6,6 +6,6 @@ module.exports = app => {
|
||||||
// a catch-all route if someone visits a page that does not exist
|
// a catch-all route if someone visits a page that does not exist
|
||||||
app.use('*', ({ originalUrl, ip }, res) => {
|
app.use('*', ({ originalUrl, ip }, res) => {
|
||||||
// send response
|
// send response
|
||||||
res.status(404).render('fourOhFour');
|
res.status(404).render('index');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
const errorHandlers = require('../helpers/errorHandlers.js');
|
|
||||||
const { getTrendingClaims, getRecentClaims } = require('../controllers/statsController.js');
|
|
||||||
const { site } = require('../config/speechConfig.js');
|
const { site } = require('../config/speechConfig.js');
|
||||||
|
|
||||||
module.exports = (app) => {
|
module.exports = (app) => {
|
||||||
|
@ -21,28 +19,11 @@ module.exports = (app) => {
|
||||||
res.status(301).redirect('/popular');
|
res.status(301).redirect('/popular');
|
||||||
});
|
});
|
||||||
app.get('/popular', ({ ip, originalUrl }, res) => {
|
app.get('/popular', ({ ip, originalUrl }, res) => {
|
||||||
const startDate = new Date();
|
res.status(200).render('index');
|
||||||
startDate.setDate(startDate.getDate() - 1);
|
|
||||||
const dateTime = startDate.toISOString().slice(0, 19).replace('T', ' ');
|
|
||||||
getTrendingClaims(dateTime)
|
|
||||||
.then(result => {
|
|
||||||
res.status(200).render('popular', {
|
|
||||||
trendingAssets: result,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
errorHandlers.handleRequestError(originalUrl, ip, error, res);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
// route to display a list of the trending images
|
// route to display a list of the trending images
|
||||||
app.get('/new', ({ ip, originalUrl }, res) => {
|
app.get('/new', ({ ip, originalUrl }, res) => {
|
||||||
getRecentClaims()
|
res.status(200).render('index');
|
||||||
.then(result => {
|
|
||||||
res.status(200).render('new', { newClaims: result });
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
errorHandlers.handleRequestError(originalUrl, ip, error, res);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
// route to send embedable video player (for twitter)
|
// route to send embedable video player (for twitter)
|
||||||
app.get('/embed/:claimId/:name', ({ params }, res) => {
|
app.get('/embed/:claimId/:name', ({ params }, res) => {
|
||||||
|
@ -52,9 +33,4 @@ module.exports = (app) => {
|
||||||
// get and render the content
|
// get and render the content
|
||||||
res.status(200).render('embed', { layout: 'embed', host, claimId, name });
|
res.status(200).render('embed', { layout: 'embed', host, claimId, name });
|
||||||
});
|
});
|
||||||
// route to display all free public claims at a given name
|
|
||||||
app.get('/:name/all', (req, res) => {
|
|
||||||
// get and render the content
|
|
||||||
res.status(410).send('/:name/all is no longer supported');
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue