[英]In an Express.js server, how can I send an HTML (with style and js) acquired from a HTTP request, as a response?
[英]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.