Passport.js Authentication Checking Middleware.
Checks if user is authenticated and redirects to desired routes.
$ npm install auth-checker
var authchecker = require('auth-checker');
// use middleware on routes to check authentication
// (success route is optional)
app.get('/myprecious', authchecker('/routeToHell', '/routeToMyPrecious'), (req, res) => {
// do your stuff...
}) ;