hi,

  I am new to nodeJS and I am reading some examples to get started and I 
found 2 samples of webserver:

sample 1)

var http = require("http");
http.createServer(function(request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Hello World");
  response.end();
}).listen(8888);

sample 2)

var http = require("http");
http.createServer(function (request, response) {
   request.on("end", function () {
      response.writeHead(200, {"Content-Type": "text/plain"});
      response.end("Hello World");
   });
}).listen(8888);


My doubt is what is that "request.on(.." in the second samples? What is the 
best approach 1 or 2?



thx,
sauLo

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to