routes.js
// route middleware to make sure a user is logged in
route middleware to make sure a user is logged in
route middleware to make sure a user is logged in
function isLoggedIn(req, res, next) {
  if (req.isAuthenticated())
    res.redirect('/dashboard');
  next();
}
function isLoggedIn ( req , res , next ) { if ( req . isAuthenticated ( ) ) res . redirect ( '/dashboard' ) ; next ( ) ; }
route middleware to make sure a user is logged in
route middleware to make sure a user is logged in
// if user is authenticated in the session, carry on // if they aren't redirect them to the home page