1.0.0 • Published 6 years ago

koa-simple-qs v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

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

1.0.0

6 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago