parameter validate middleware for koa, powered by parameter.
$ npm install koa-parameter --save
var koa = require('koa');
var parameter = require('koa-parameter');
parameter(app); // add verifyParams method, but don't add middleware to catch the error
// app.use(parameter(app)); // also add a middleware to catch the error.
app.use(function* () {
this.verifyParams({
name: 'string'
});
});
Checkout parameter to get all the rules.
MIT