@koa/bodyparser
Advanced tools
Comparing version
@@ -133,3 +133,3 @@ var __create = Object.create; | ||
} | ||
return async function(ctx, next) { | ||
return async function bodyParser(ctx, next) { | ||
if ( | ||
@@ -136,0 +136,0 @@ // method souldn't be parsed |
@@ -136,3 +136,3 @@ var __create = Object.create; | ||
} | ||
return async function(ctx, next) { | ||
return async function bodyParser(ctx, next) { | ||
if ( | ||
@@ -139,0 +139,0 @@ // method souldn't be parsed |
{ | ||
"name": "@koa/bodyparser", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Koa body parsing middleware", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -9,3 +9,3 @@ # [**@koa/bodyparser**](https://github.com/koajs/bodyparser) | ||
[npm-image]: https://img.shields.io/npm/v/@koa/bodyparser.svg?style=flat-square | ||
[npm-url]: https://www.npmjs.com/package/@koa/router | ||
[npm-url]: https://www.npmjs.com/package/@koa/bodyparser | ||
[github-action-image]: https://github.com/koajs/bodyparser/actions/workflows/ci.yml/badge.svg?style=flat-square | ||
@@ -28,3 +28,3 @@ [coveralls-image]: https://img.shields.io/coveralls/koajs/bodyparser.svg?style=flat-square | ||
```bash | ||
$ npm i @koa/bodyparser | ||
$ npm i @koa/bodyparser --save | ||
``` | ||
@@ -36,3 +36,3 @@ | ||
const Koa = require("koa"); | ||
const bodyParser = require("@koa/bodyparser"); | ||
const { bodyParser } = require("@koa/bodyparser"); | ||
@@ -122,9 +122,23 @@ const app = new Koa(); | ||
```bash | ||
npm install koa-bodyparser@2 --save | ||
$ npm install koa-bodyparser@2 --save | ||
``` | ||
#### Licences | ||
usage | ||
--- | ||
```js | ||
const Koa = require("koa"); | ||
const bodyParser = require("@koa/bodyparser"); | ||
const app = new Koa(); | ||
app.use(bodyParser()); | ||
app.use((ctx) => { | ||
// the parsed body will store in ctx.request.body | ||
// if nothing was parsed, body will be an empty object {} | ||
ctx.body = ctx.request.body; | ||
}); | ||
``` | ||
## Licences | ||
[MIT](LICENSE) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37684
0.97%141
11.02%