einsqing / koa-body-res

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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'
}

作者官网: http://www.wemallshop.com

About


Languages

Language:JavaScript 100.0%