【发布时间】:2015-06-23 08:43:10
【问题描述】:
我最终想从 RESTful Web 服务获取特定的 id,对其进行修改并将其放回(更新)。下面的代码从 Web 服务中获取所有内容,我如何修改它以获取特定的 id?
request({
url: url, // URL to hit
qs: { from: 'blog example', time: +new Date() }, // Query string data
method: 'GET', // Specify the method
}, function(error, response, body) {
if (error) {
res.render('index', { title: 'Express', data: []});
} else {
console.log(body);
res.render('index', { title: 'Express', data: JSON.parse(body) });
}
});
【问题讨论】:
标签: javascript node.js rest express request