Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. // src/middleware/AuthMiddleware.ts
  2.  
  3. import {Request, Response, NextFunction} from "express";
  4.  
  5. export function AuthMiddleware(req: Request, res: Response, next: NextFunction) {
  6. if (!req.header('Authorization')) {
  7. return res.status(401).send('unauthorized');
  8. }
  9.  
  10. next();
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement