spee.ch/routes/page-routes.js
2018-01-31 19:21:00 -08:00

36 lines
1.1 KiB
JavaScript

const { site } = require('../config/speechConfig.js');
module.exports = (app) => {
// route to log out
app.get('/logout', (req, res) => {
req.logout();
res.redirect('/');
});
// route to display login page
app.get('/login', (req, res) => {
res.status(200).render('index');
});
// route to show 'about' page
app.get('/about', (req, res) => {
res.status(200).render('index');
});
// route to display a list of the trending images
app.get('/trending', (req, res) => {
res.status(301).redirect('/popular');
});
app.get('/popular', ({ ip, originalUrl }, res) => {
res.status(200).render('index');
});
// route to display a list of the trending images
app.get('/new', ({ ip, originalUrl }, res) => {
res.status(200).render('index');
});
// route to send embedable video player (for twitter)
app.get('/embed/:claimId/:name', ({ params }, res) => {
const claimId = params.claimId;
const name = params.name;
const host = site.host;
// get and render the content
res.status(200).render('embed', { layout: 'embed', host, claimId, name });
});
};