I\'m looking to use information from an HTTP request using Node.js (i.e. call a remote web service and echo the response to the client).
In PHP I would have used cUR
Use request npm module and after call
var request = require('request');
request('http://www.google.com', function (error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body); // Print the HTML for the Google homepage.
});
For best practice also use some winston logger module or else simple console.log and then run your application like
npm start output.txt
Result of above command will generate one txt file on root with all data which you have printed in console.log