services/login.js
// Define middleware to redirect pages to login if no-one is logged in
Define middleware to redirect pages to login if no-one is logged in
Define middleware to redirect pages to login if no - one is logged in
function loggedIn(req, res, next) {
  if (req.user) {
    next();
  } else {
    res.redirect("/login/");
  }
}
function loggedIn ( req , res , next ) { if ( req . user ) { next ( ) ; } else { res . redirect ( "/login/" ) ; } }
Define middleware to redirect pages to login if no-one is logged in
Define middleware to redirect pages to login if no - one is logged in