基于Node.js开发的KoaHub.js的输出json到页面
程序员文章站
2022-05-08 21:57:40
...
基于Node.js开发的KoaHub.js的输出json到页面
koahub-body-res
koahub body res
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
koahub-body-res
koahub body res
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
推荐阅读
-
vue.js实现数据库的JSON数据输出渲染到html页面功能示例
-
基于 Koa平台Node.js开发的KoaHub.js连接打印机的代码
-
基于Node.js开发的KoaHub.js的输出json到页面
-
基于 Koa平台Node.js开发的KoaHub.js的跳过组件代码
-
基于 Koa平台Node.js开发的KoaHub.js的跳过组件代码
-
KoaHub.JS基于Node.js开发的Koa 生成验证码插件代
-
基于 Koa平台Node.js开发的KoaHub.js连接打印机的代码
-
基于 Node.js开发的KoaHub.js获取/设置会话功能代码
-
基于 Koa平台Node.js开发的KoaHub.js的模板引擎代码
-
基于Node.js开发的KoaHub.js的输出json到页面