middlewares/isLogin.js
// Function to check if there is session
Function to check if there is session
Function to check if there is session
function isLogin(req, res, next) {
  console.log(req.session)
  if (req.session.email) {
    next()
  } else {
    res.redirect(`/login?err=Please login first!`)
  }
}
function isLogin ( req , res , next ) { console . log ( req . session ) if ( req . session . email ) { next ( ) } else { res . redirect ( ` ` ) } }
Function to check if there is session
Function to check if there is session