Method description:
Since most requests are GET requests that do not contain a request body. Node.js provides an easier way to make requests.
The difference between this method and Http.request() is that this method only requests in GET mode, and will automatically call req.end() to end the request.
Grammar:
Since this method belongs to the http module, the http module needs to be introduced before use (var http= require("http") )
Receive parameters:
option represents the domain name or IP address of the requested website (requested address)
callback The callback function passes a parameter res, which is the response object, indicating the response to be made after receiving the request. If you want to know what attributes res has, you can check "http.response attribute integration".
res is an instance of http.ClientResponse.
Example:
Source code: