A simple alias of qs for koa.
Use 1.x versions for koa 2.x-3.x support
- Middleware usage
- Not all apps are alike. Configure it with your own options.
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' }
*/
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