express-decorators-joi
Defines a middleware function for express-decorators that validates request data using Joi.
Installation
$ npm install --save express-decorators-joi
Usage
;; @web @web @ { // request.data contains the validated (and converted) data }
It validates request.body
, so you'll need body-parser installed and use
d. If the validation fails, the middleware calls next
with a Joi ValidationError
. You should probably trap this error and return an HTTP 400, e.g.:
app;
That's about it.
Licence etc
ISC, do what you want. All bug reports, issues, comments, suggestions and pull requests welcome.