flame/middleware/requireAuth.js

12 lines
236 B
JavaScript
Raw Permalink Normal View History

const ErrorResponse = require('../utils/ErrorResponse');
const requireAuth = (req, res, next) => {
if (!req.isAuthenticated) {
return next(new ErrorResponse('Unauthorized', 401));
}
next();
};
module.exports = requireAuth;