Adding config and passport files

As mentioned earlier, let's create a config file:

  1. Inside server/config, create a file called config.js and place the following code in it:
          // Database URL 
          module.exports = { 
              // Connect with MongoDB on local machine 
              'url' : 'mongodb://localhost/mvc-app' 
          }; 
    
  2. Create a new file on server/config and name it passport.js. Add the following content:
          // load passport module      var LocalStrategy = require('passport-local').Strategy;      // load up the user model      var User = require('../models/users');      module.exports = function(passport) {      // passport init setup      // serialize the user for the session      passport.serializeUser(function(user, done) {      done(null, user.id); ...

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.