Skip to Content
Building Scalable Apps with Redis and Node.js
book

Building Scalable Apps with Redis and Node.js

by Joshua Johanan
September 2014
Intermediate to advanced
316 pages
7h 6m
English
Packt Publishing
Content preview from Building Scalable Apps with Redis and Node.js

Let's build our authentication

With our packages installed, we now have the basis to build our authentication system. The first thing to do is create a folder named passport and create a file named index.js in that folder. Inside index.js, we will get a reference to Passport and pass it back to the main app.js, as shown in the following code:

var passport = require('passport');

exports.passport = passport;

We could have done this in app.js, but we are going to set some things up and add some utility functions to this object. This will help keep our app.js file clean and easy to understand. We can now jump over to app.js and use our new module. Add the following lines to app.js:

//at the top with variable declarations
passport = require('./passport'); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reactive Programming with Node.js

Reactive Programming with Node.js

Fernando Doglio
Node: Up and Running

Node: Up and Running

Tom Hughes-Croucher, Mike Wilson
Learn TypeScript 3 by Building Web Applications

Learn TypeScript 3 by Building Web Applications

Sebastien Dubois, Alexis Georges

Publisher Resources

ISBN: 9781783984480Supplemental Content