错误:连接ETIMEDOUT,Node js如何在本地主机API之间进行通信

我有一些后端服务,正在监听端口8080.而我有另一个节点js API在本地端口上监听端口3000。

我怎样才能从节点服务器到后端API?

这是我的节点js代码:

router.post('/', function(req, res, next) { console.log('got validate request'); var options = { host:'localhost', port:8080, path:'/***/getservice', method:'GET' } http.request(options, function (response) { console.log('response:', response); // Print the error if one occurred res.json(response); res.end(); }); }); 

上面的代码会导致错误:连接ETIMEDOUT。