Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // src/middleware/AuthMiddleware.ts
- import {Request, Response, NextFunction} from "express";
- export function AuthMiddleware(req: Request, res: Response, next: NextFunction) {
- if (!req.header('Authorization')) {
- return res.status(401).send('unauthorized');
- }
- next();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement