i'm beginner node.js, installed here: https://github.com/joyent/node/wiki/installing-node.js-via-package-manager
i tried console , worked:
console.log('hello world!');
nodejs helloconsole.js
> hello world!
then tried make within http server, here code:
var http = require("http"); http.createserver(function (request, response) { request.on("end", function () { response.writehead(200, { 'content-type': 'text/plain' }); response.end('hello http!'); }); }).listen(8080);
i run terminal:
nodejs hello.js
then open browser @ http://localhost:8080/
, takes long time load, @ chrome gives me that:
unable load webpage because server sent no data.
and firefox gives me that:
the connection has timed out
note : other web servers works fine, apache.
you listening "end" event of request parameter, @ time outermost callback function called, request has ended, late subscribe event.
you can directly respond outermost callback, sample code in nodejs.org shows.
Comments
Post a Comment