koa-strong-params
Rails-style implementation of strong parameters for Koa. The middleware adds the this.params
object to the Koa context which returns an object, built from query string
and request body
data. The returned object has some useful methods allows for data requiring
and filtering
.
You should consider using koa-qs and koa-bodyparser packages together with koa-strong-params
.
Installation
Install the npm package.
npm install koa-strong-params --save
Attach the middleware.
var koa = ;var params = ;var app = ;app;
Example
var koa = ;var params = ;var bodyparser = ;var qs = var app = ;; // required for nested query string objectsapp; // required for params to include request body objectsapp;app;app;