Definition of custom validation function. Custom validation function should throw an error when ever validation fails.
Custom validation function with context object.
Allowed sanitation functions by validator.
Allowed validation function name. This is the available list of validators in the validator.js -module.
Validate request body.
The parameter to be validated from request.
router.post(
'/auth/login',
body('username').equals('user').build(),
body('password').equals('pass').build(),
handler
);
Validate request param.
The parameter to be validated from request.
router.get(
'/api/users/:id',
param('id').isInt().build(),
handler
);
Validate request query.
The parameter to be validated from request.
router.get(
'/api/tags',
query('search').contains('_').build(),
handler
);
Get validation results out of the context.
The request context
Generated using TypeDoc
Custom validation error message function. This function will receive the request context and the user's input for the parameter, and it has to return the error message as a result.f