January 2018
Beginner
658 pages
13h 10m
English
Inside server.js, we already have a root for /about, which means we can render our hbs template instead of sending back this about page string. We will remove our call to res.send and we'll replace it with res.render:
app.get('/about', (req, res) => { res.render});
Render will let us render any of the templates we have set up with our current view engine about.hbs file. We do indeed have the about template and we can pass that name, about.hbs, in as the first and only argument. We'll render about.hbs:
app.get('/about', (req, res) => { res.render('about.hbs');});
This will be enough to get that static page rendering. We'll save server.js and in the Terminal, we'll clear the output and we'll run our server ...
Read now
Unlock full access