# koa-ajax-params

> The Koa Middleware used to auto parse get & post request params

Latest version **0.0.3** (published 2017-06-06) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install koa-ajax-params
pnpm add koa-ajax-params
yarn add koa-ajax-params
bun add koa-ajax-params
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2017-06-06 |
| First published | 2017-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Val.istar.Guo |
| Maintainers | val.istar.guo |

## Links

- npm: https://www.npmjs.com/package/koa-ajax-params
- Repository: https://github.com/Val-istar-Guo/koa-ajax-params
- Homepage: https://github.com/Val-istar-Guo/koa-ajax-params#readme
- Issues: https://github.com/Val-istar-Guo/koa-ajax-params/issues
- npm.io page: https://npm.io/package/koa-ajax-params

## Recent versions

- 0.0.3 (latest) — 2017-06-06
- 0.0.2 — 2017-06-06
- 0.0.1 — 2017-06-06

## README

# KOA-AJAX-PARAMS

The Koa Middleware used to auto parse get & post request params.

## Install

```bash
npm i koa-ajax-params
```

```bash
yarn add kao-ajax-params
```

## Usage

For POST Request, when Content-Type is `application/json`,
middleware will auto parse body data to json that can be get from `this.param.post`.

For GET Request, you can get url query from `this.param.get.xxx`.

```javascript
import Koa from 'koa';
import router from 'koa-router';
import ajaxParamsParse from 'koa-ajax-params';

const app = new Koa();
const route = new router({
  prefix: '/api',
});

route
  .use(ajaxParamsParse())
  .get('/path', async function() {
    const id = this.param.get.id;
  })
  .post('/path', async function() {
    const id = this.param.post.id;
  });
```


## Content-Type Support

- application/json


## Feature

- Support `application/x-www-form-urlencoded`
- Support `multipart/form-data`
- Support `text/xml`

---
_Source: https://npm.io/package/koa-ajax-params · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
