koa-simple-qs
v1.0.0
Published
Simple Koa query string support
Downloads
154
Readme
koa-simple-qs
A simple alias of qs for koa.
Use 1.x versions for koa 2.x-3.x support
Why not koa-qs?
- Middleware usage
- Not all apps are alike. Configure it with your own options.
Usage
let app = new Koa();
app.use(require('koa-simple-qs')());
app.get('/test', async (ctx) => {
console.log(ctx.request.body);
});
...
/*
/test?q=test => { q: 'test' }
*/
With options
let app = new Koa();
app.use(require('koa-simple-qs')({
strictNullHandling: true
}));
app.get('/test', async (ctx) => {
console.log(ctx.request.body);
});
...
/*
/test?q=test&a => { q: 'test', a: null }
*/
PRs welcome