Skip to content

koexjs/body

Repository files navigation

body

NPM version NPM quality Coverage Status Dependencies Build Status Known Vulnerabilities NPM download license issues

body parser for koa extend.

Install

$ npm install @koex/body

Usage

// See more in test
import onerror from '@koex/onerror';
import bodyParser from '@koex/body';
import * as router from '@koex/router';

import * as Koa from 'koa';
const app = new Koa();

app.use(onerror());
app.use(bodyParse());

app.use(router.post('/', ctx => {
  ctx.body = ctx.request.body;
}));

app.listen(8000, '0.0.0.0', () => {
  console.log('koa server start at port: 8000');
});

Related