Refactoring the app.js file with the new middleware
At this time, we have to do a major restructuring of the app.js
file to include the new middleware that we will use.
We will show you step by step how to include each middleware and at the end, we will see the complete file:
- Open
app.js
and add the following lines beforevar app = express()
:// ODM With Mongoose var mongoose = require('mongoose'); // Modules to store session var session = require('express-session'); var MongoStore = require('connect-mongo')(session); // Import Passport and Warning flash modules var passport = require('passport'); var flash = require('connect-flash');
This is a simple import process.
- Add the following lines after
app.set('view ...
Get Node.js 6.x Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.