在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:dionoid/koa-request开源软件地址:https://github.com/dionoid/koa-request开源编程语言:JavaScript 100.0%开源软件介绍:koa-requestVery simple wrapper to the request library for use in koa. To install simply run: npm install koa-request Require koa first and will only work on node v0.11.7 or newer. You must run node with --harmony flag (--harmony-generators works as well) node --harmony example.js Simple example using koa-request in koa: var koa = require('koa');
var request = require('koa-request');
var app = koa();
app.use(function *() {
var options = {
url: 'https://api.github.com/repos/dionoid/koa-request',
headers: { 'User-Agent': 'request' }
};
var response = yield request(options); //Yay, HTTP requests with no callbacks!
var info = JSON.parse(response.body);
this.body = 'my full name is ' + info.full_name;
});
app.listen(process.env.PORT || 8080); |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论