Q:

Write a node.js program for making external http calls

belongs to collection: Node.js programming Exercises

0

Write a node.js program for making external http calls

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution

It is often necessary for a network application to make external HTTP calls. HTTP servers are also often called upon to perform HTTP services for clients making requests. Node.js provides an easy interface for making external HTTP calls. For example, the following code will fetch the front page of 'google.com'.

var http = require('http');
http.request({
host: 'www.google.com',
method: 'GET',
path: "/"
}, function(response) {
response.setEncoding("utf8");
response.on("readable", function() {
console.log(response.read())
});
}).end();

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a program in node.js to parse the given url... >>