Configuration Object
Once we have defined all our Joi specs, its time to configure our middleware. Following is a high-level schema of configuration object expected by xpress-req-validator
allowUndefinedPaths
if set to true
, middleware will allow undefined routes to pass through
if set to false
, middleware will raise an INVALID URL
error
default is true
sendErrorResponse
if set to true
, middleware will send responses directly with validation errors
if set to false, middleware will pass the validation errors to next middleware
default is false
Error response takes the following shape
Last updated
Was this helpful?