Reputation: 1633
Oops! 10000 points to jimw!
I'm trying to start a hobby project using Node. So I got going:
and then I get this:
Firefox can't establish a connection to the server at 127.0.0.1.
Code:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
Any ideas? Right now I'm kind of baffled that "Hello world" isn't working (!)
Upvotes: 0
Views: 704
Reputation: 1633
I don't know how to close the question, so I'll just answer myself.
jimw's comment was the answer - I was trying to access the wrong port because I entered localhost/1337 instead of localhost:1337, I was just blind.
Thanks a lot ;)
Upvotes: 1