http.get(options[, callback])
Since most requests are GET requests without bodies, Node.js provides this convenience method. The only difference between this method and http.request()
is that it sets the method to GET and calls req.end()
automatically.
Example:
http.get('http://www.google.com/index.html', (res) => { console.log(`Got response: ${res.statusCode}`); // consume response body res.resume(); }).on('error', (e) => { console.log(`Got error: ${e.message}`); });
Please login to continue.