koa-joi-schema
Koa middleware to validate input using Joi.
Installing
npm i -S koa-joi-schema joi
Note: Joi is a peer dependency, so it must be installed independently.
Usage
See test.js for more examples.
const validate = const Joi = // Creates a validator for 'ctx.request.body'.// Use dot notation to validate anything on the context.const validator = Joiobject const validationErrorHandler = { try catch e if !eisJoi throw e ctxstatus = 400 // invalid input ctxbody = error: 'Invalid input' reason: e } router
License
ISC