javascript - Started Playing with node.js. I have a question -
i created http server using code fro documentation:
var sys = require("sys"), http = require("http"); http.createserver(function(request, response) { response.writehead(200, {"content-type": "text/plain"}); response.end("hello world!"); sys.puts('connection'); }).listen(8080); sys.puts("server running @ http://localhost:8080/");**
my question is, why when go localhost:8080 got "connection" printed twice? bug?
your browser may requesting url twice, once head request , once request. try using simple interface, telnet
:
$ telnet localhost 8080 / http/1.0 ^]q
leave blank line after get
, , press ctrl+]qenter out.
Comments
Post a Comment