Let's take a minute to do a quick recap and see what we've done up to this point. So far, we have:
Created
index.handlebars
andimage.handlebars
—the views for the two main pages of the applicationCreated
layouts/main.handelbars
—the main layout file for every page in the applicationCreated
partials/comments.handlebars
,popular.handlebars
, andstats.handlebars
Created a global
timeago
Handlebars 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: function(req, res) { res.render('index'); } };
Instead of performing res.send
, which just sends a simple response, we are calling res.render...