Guest User

Untitled

a guest
Oct 13th, 2019
86
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data