Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// User requests the /app/ route -> Check if he is authenticated
router.get('/app/', isAuthenticated, (req, res) => res.render('app') );
// The isAuthenticated function is using passport.js here to see if the user is logged in (req.isAuthenticated)
// It that's not the case, we redirect them to the login route.
const isAuthenticated = (req, res, next) => {
if(req.isAuthenticated()) return next();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.