Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. import {validationResult} from "express-validator";
  2.  
  3. export function showApiError(req: Request, res: Response, next: NextFunction) {
  4. const errors = validationResult(req);
  5. if (!errors.isEmpty()) {
  6. return res.status(400).json({ errors: errors.array() });
  7. }
  8.  
  9. next();
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement