const withAuth = (req, res, next) => {
    // If the user is not logged in, redirect the request to the login route
    // console.log('session >>> ', res.session)
    if (!req.session.loggedIn) {
      return res.status(403).end();
    
      // return res.redirect('/login');
    } else {
      next();
    }
};
  
module.exports = withAuth;
{'avg_line_length': 26.384615384615383, 'max_line_length': 76, 'alphanum_fraction': 0.5743440233236151, 'licenses': ['MIT'], 'repository_name': 'SLUDGE-GIT/happyhealth', 'path': 'utils/auth.js', 'size': 343, 'lang': 'JavaScript'}