aboutsummaryrefslogtreecommitdiffstats
path: root/middleware/auth.js
blob: 4f98a819aeea4f0eac4de5f7a5edb2ecffa26473 (plain)
1
2
3
4
5
6
7
8
9
10
function requireAuth(req, res, next) 
{
   if (req.session.userId) 
   {
      return next();
   }
   res.status(401).json({ error: 'Not authenticated' });
}

module.exports = requireAuth;