1.0.7 • Published 8 years ago

koahub-body-res v1.0.7

Weekly downloads
1
License
ISC
Repository
github
Last release
8 years ago

Format koa's respond json.

Installation

$ npm install koahub-body-res

Use with koa

var app = require('koa')();
var koaRes = require('koahub-body-res');
app.use(koaRes());

this.data = 'This is a body';
this.msg = 'This is a msg';
this.go = 'This is a go url';

output

this.body = {
	code: 200,
	data: 'This is a body',
	msg: 'This is a msg'
}

this.body = {
    code: 200,
    data: 'This is a body',
    msg: 'This is a msg',
    go: 'This is a go url'
};

官网:http://js.koahub.com

image