Moved away from SSR to regular Node API server.
This commit is contained in:
parent
9aea69c7be
commit
83d93aefc0
30 changed files with 939 additions and 1024 deletions
12
src-server/middlewares/authMiddleware.js
Normal file
12
src-server/middlewares/authMiddleware.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
// 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();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue