updated BE file naming convention
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { NextFunction } from "express";
|
||||
import { validationResult } from "express-validator";
|
||||
import { Request, Response } from "express";
|
||||
|
||||
export const middlewareValidationFunction = (
|
||||
req: Request,
|
||||
res: Response,
|
||||
next: NextFunction
|
||||
) => {
|
||||
const errors = validationResult(req);
|
||||
if (!errors.isEmpty()) {
|
||||
return res.status(400).json({ errors: errors.array() });
|
||||
}
|
||||
next();
|
||||
};
|
||||
Reference in New Issue
Block a user