Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 1.61 KB

README.md

File metadata and controls

46 lines (35 loc) · 1.61 KB

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