mirror of
https://github.com/pawelmalak/flame.git
synced 2026-02-28 09:23:12 +08:00
Backend: auth for config and queries. Refactor of middleware exports
This commit is contained in:
11
middleware/requireAuth.js
Normal file
11
middleware/requireAuth.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const ErrorResponse = require('../utils/ErrorResponse');
|
||||
|
||||
const requireAuth = (req, res, next) => {
|
||||
if (!req.isAuthenticated) {
|
||||
return next(new ErrorResponse('Unauthorized', 401));
|
||||
}
|
||||
|
||||
next();
|
||||
};
|
||||
|
||||
module.exports = requireAuth;
|
||||
Reference in New Issue
Block a user