ecliptica/server/routers/webstar-project/middleware/auth-middleware.js

15 lines
303 B
JavaScript
Raw Permalink Normal View History

2024-05-22 15:11:46 +03:00
const authMiddleware = (req, res, next) => {
const email = (req.headers.authorization || "").replace("Bearer ", "");
if (email) {
req.userEmail = email;
next();
} else {
return res.status(403).json({
message: "Access Denied",
});
}
};
module.exports = authMiddleware