SHARE
TWEET

Untitled

a guest Oct 13th, 2019 80 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top