繁体   English   中英

如何通过Express.js从请求中传递响应?

[英]How to pipe response from request in 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)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM