const requireAuth = (req, res, next) => {
  if (req.session && req.session.userId) {
    next();
  } else {
    return res.status(401).json({ message: 'Unauthorized. Please login.' });
  }
};

module.exports = { requireAuth };
