express-validator-middleware
v1.1.5
Published
Typescript-friendly form validator middleware for express.js
Downloads
17
Maintainers
Readme
Express validator middleware
Typescript-friendly form validator middleware for express.js.
install
$ npm install express-validator-middleware
Usage
import baseValidator, { safeUsername, safeEmail } from "express-validator-middleware";
interface SignupForm {
username: string;
password: string;
email: string;
}
export const signupValidator = (req: Request, res: Response, next: NextFunction) =>
baseValidator<SignupForm>(
{
username: [safeUsername],
password: [],
email: [safeEmail],
},
req,
res,
next
);