Getting started with node, waiting for localhost
I am new to Node, figured I would check it out and do a hello world. I
have been having the same issue on all three of my machines, a Win 8, Win
7 and a Mac. thought at first it was a firewall issue, but I checked and
it was off on both mac and windows 8 machines (didn't bother checking the
win7). When I run node from the terminal the browser waits for
localhost,then eventually times out,I have been at this for two days,
can't seem to find any issue via google. What am I missing.?
Here is my code:
var http = require("http");
console.log("file loaded");
http.createServer(function (request, response) {
request.on("end", function () {
response.writeHead(200, {
'Content-Type': 'text/plain'
});
response.end('Hello HTTP!');
});
}).listen(8080);
No comments:
Post a Comment