updated page routes to server side render

This commit is contained in:
bill bittner 2018-02-21 13:58:25 -08:00
parent 224d057b9a
commit 73326a96d3
2 changed files with 15 additions and 6 deletions

View file

@ -1,9 +1,18 @@
const { site } = require('../config/speechConfig.js');
module.exports = (html, preloadedState) => {
// take the html and preloadedState and return the full page
return `
<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>${site.title}</title>
<link rel="stylesheet" href="/assets/css/reset.css" type="text/css">
<link rel="stylesheet" href="/assets/css/general.css" type="text/css">
<link rel="stylesheet" href="/assets/css/mediaQueries.css" type="text/css">
<!--google font-->
<link href="https://fonts.googleapis.com/css?family=Roboto:300" rel="stylesheet">
</head>

View file

@ -8,22 +8,22 @@ module.exports = (app) => {
});
// route to display login page
app.get('/login', (req, res) => {
res.status(200).render('index');
handleRender(req, res);
});
// route to show 'about' page
app.get('/about', (req, res) => {
res.status(200).render('index');
handleRender(req, res);
});
// 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');
app.get('/popular', (req, res) => {
handleRender(req, res);
});
// route to display a list of the trending images
app.get('/new', ({ ip, originalUrl }, res) => {
res.status(200).render('index');
app.get('/new', (req, res) => {
handleRender(req, res);
});
// route to send embedable video player (for twitter)
app.get('/embed/:claimId/:name', ({ params }, res) => {