【发布时间】:2016-12-19 14:06:53
【问题描述】:
我希望能够将某些东西从我的机器卷曲到我的服务器。服务器应该向另一台机器发送另一个请求,并以该响应进行响应。类似代理的东西。所以现在我有(某些部分由于原因被混淆了):
internalHttpServer = _Http.createServer(function (request, response) {
if(request is valid){
pass_on_request(request, response); /** Sends the request on another server **/
respond_with_data(request, response); /** how do I write this function to respond with the other result? **/
}
}
respond_400(response);
});
function pass_on_request(req, res) {
var id = get_id_to_request_from()
list_of_other_connections[id].sendUTF(request)
/** How do I send res with the results of this call? **/
connection.on('message', function(message) {
/** what to do **/
});
提前致谢
【问题讨论】:
标签: javascript node.js curl callback