Sindbad~EG File Manager
import { jwtService } from "../utils/jwtService";
import catchAsync from "../utils/catchAsync";
const jwtMiddleware = catchAsync(async (req, res, next) => {
const authHeader = req.headers["authorization"];
const token = authHeader && authHeader.split(" ")[1];
if (!token) {
return res.status(403).json({ message: "No token provided" });
}
await jwtService.verifyToken(token).then((decodedToken) => {
req.user = decodedToken;
next();
});
});
export default jwtMiddleware;
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists