August 2016
Intermediate to advanced
376 pages
6h 33m
English
controllers inside the root project folder.index.js inside the controllers folder and place the following code: // Index controller
exports.show = function(req, res) {
// Show index content
res.render('index', {
title: 'Express'
});
};
app.js file and replace the original index route app.use('/', routes); with the following code: app.get('/', index.show);
app.js file right after var swig = require('swig'); declaration, replace the original code with the following code: // Inject index controller
var index = require('./controllers/index');