Skip to content

thomseddon/koa-body-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project has been depreciated in favour of: https://github.com/koajs/bodyparser


koa-body-parser Build Status

Parse the request body in koa like ya' used to in express

Installation

npm install koa-body-parser

Options

  • empty whether to throw a 415 if the client has indicated there is a body but it cannot be parsed (default: true)
  • length length limit of the stream to pass to raw-body (default: content-length)
  • limit byte limit of the body to pass to raw-body, throws 413 if body is larger
  • encoding requested encoding (default: utf8)

Example

var bodyParser = require('koa-body-parser');
var koa = require('koa');

var app = koa();

app.use(bodyParser());

app.use(function *() {
  this.body = this.request.body; // Echo request back
  this.status = 200;
});

app.listen(3000);

License

MIT

About

Parse the request body in koa like ya' used to in express

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published