multy-stub/server/routers/webstar-project/middleware/auth-middleware.js
2024-05-22 15:11:46 +03:00

15 lines
303 B
JavaScript

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