// src-ssr/middlewares/authMiddleware.js

export function requireAuth(req, res, next) 
{
  if (!req.session || !req.session.loggedInUserId) 
  {
    // User is not authenticated
    return res.status(401).json({ error: 'Authentication required' });
  }
  // User is authenticated, proceed to the next middleware or route handler
  next();
}
