Rendering the views
Let's take a minute to do a quick recap and see what we've done up to this point. So far, we have done the following:
- We created
index.Handlebarsandimage.Handlebars, the views for the two main pages of the application - We created
layouts/main.handelbars, the main layout file for every page in the application - We created
partials/comments.Handlebars,popular.Handlebars, andstats.Handlebars - We created a global
timeagoHandlebars helper
So far, so good; however, none of these views actually do anything, receive any viewModels, or even appear when you run the application! Let's make a few quick minor modifications to our controllers to get our views to render properly.
Open /controllers/home.js so that you can edit the home controller module.
Update the contents of that file so that it looks identical to the following block of code:
module.exports = {
index: (req, res)=> {
res.render('index');
}
}; Instead of performing res.send, which just sends a simple...