1.0.4 • Published 8 years ago
koa-body-res v1.0.4
Format koa's respond json.
Installation
$ npm install koa-body-res
Use with koa
var app = require('koa')();
var koaRes = require('koa-body-res');
app.use(koaRes());
this.data = 'This is a body';
this.msg = 'This is a msg';
output
this.body = {
code: 200,
data: 'This is a body',
msg: 'This is a msg'
}