koa-simple-qs

1.0.0 • Public • Published

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?

  1. Middleware usage
  2. 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

Readme

Keywords

Package Sidebar

Install

npm i koa-simple-qs

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

56.4 kB

Total Files

7

Last publish

Collaborators

  • james1x0