diff options
| author | pack <pack@packgekko.xyz> | 2026-08-12 17:06:50 +0000 |
|---|---|---|
| committer | pack <pack@packgekko.xyz> | 2026-08-12 17:06:50 +0000 |
| commit | 5611527e313c4add16c432e5cf9d55a987558c02 (patch) | |
| tree | 59ad054325096b6305277b94982bbe7f7f585f59 /middleware/auth.js | |
| parent | d3adc16a08d95d6e331de55d7d3bf05a66a874a8 (diff) | |
| download | crud-5611527e313c4add16c432e5cf9d55a987558c02.tar.gz | |
final commit
Diffstat (limited to 'middleware/auth.js')
| -rw-r--r-- | middleware/auth.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/middleware/auth.js b/middleware/auth.js index e69de29..4f98a81 100644 --- a/middleware/auth.js +++ b/middleware/auth.js @@ -0,0 +1,10 @@ +function requireAuth(req, res, next) +{ + if (req.session.userId) + { + return next(); + } + res.status(401).json({ error: 'Not authenticated' }); +} + +module.exports = requireAuth; |