如何在Express.js中响应请求?
所以我使用request
库来获得一个URL。 我想用Express来response
,但是我还没有弄明白怎么做。
function routeHandler(req, res) { ... request.getAsync(theUrl) .spread(function(response,body) { // how to pipe it to res here? })
它的请求库支持。 我应该仔细阅读文件。
var reply = request(actualUrl) req.pipe(reply) reply.pipe(res)