Koa-joi-bouncer
An http parameter validation library for Koa.js web apps
npm install --save koa-joi-bouncer
The idea
Separate the validation logic from the route itself, just define an schema and use it before the route.
Koa 2
If you want to use it with koa v2 use the tag 'next'
npm install --save koa-joi-bouncer@next
Usage
const koa = ;const app = ;const Router = ;const koaJoiBouncer = ;const Joi = koaJoiBouncerJoi; const router = ; const myRouteValidation = koaJoiBouncer; const myRoute = { thisresponsebody = `Hello there `;} router; app; app; app;
Check the tests for more examples
TODO:
- Allow sending options to JOI
- Allow more specification for the validation key e.g. 'request.body2'
- Add https://david-dm.org/
- Add https://travis-ci.org/
- Add npm badge