node.js - How to communicate between locally running web services -


i have back-end services can called through api gateway server. back-end services in spring rest service , api gateway node server .these 2 servers running locally on different ports(backend:8080 , node :3000).

how can make request back-end service node server ?

if both expose rest api can make use of inbuilt- http module communication

    require('http');         var options = {       host: 'www.google.com',       port: 80,       path: '/index.html'     };      http.get(options, function(res) {       console.log("got response: " + res.statuscode);        res.on("data", function(chunk) {         console.log("body: " + chunk);       });     }).on('error', function(e) {       console.log("got error: " + e.message);     }); 

but recommend using libraries superagent or axios


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -