javascript - node program not exiting -
I am new to node. Js. Trying to create a HTTP request using the GET method through the node, prints "print reply: 302" and keeps going out without leaving the code according to the code it needs to get out of the node. Unable to understand the reason for the wait of the node without exiting the program.
var options = {host: 'www.google.com', port: 80, path: '/ index html'}; At ('error', function (e) {console.log ("goto error:" + E.message);}); By default, the preventable stream in a paused state in node v0.10 +
So if you have feedback data, then you have to remove the response to the process of naturally going out:
http.get (options, function (to stop data loss) Res) {console.log ("Got response:" + Res.statusCode); // This forces behaves streams 1 and 'data' emits events which we / Received the, to effectively drain the stream ... res.resume ();}) (the 'error' function) {Console.log ( "error was:" + e.message);});
Comments
Post a Comment