Login/logout changes to app.js

We have a few changes required in app.mjs, some of which we've already touched on. We did carefully isolate the Passport module dependencies to routes/users.mjs. The changes required in app.mjs support the code in routes/users.mjs.

It's now time to uncomment a line we told you to comment out way back in Chapter 5, Your First Express Application. The imports for the routing modules will now look as follows:

import { router as index } from './routes/index';import { router as users, initPassport } from './routes/users';import { router as notes } from './routes/notes'; 

The User router supports the /login and /logout URL's as well as using Passport for authentication. We need to call initPassport for a little bit ...

Get Node.js Web Development - Fourth Edition 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.