Answered/fixed:
Oops! 10000 points to jimw!
I’m trying to start a hobby project using Node. So I got going:
- installed Node 0.6.14
- copy-pasted the “hello world” program from their homepage in Eclipse
- saved as Main.js
- launched (node Main.js)
- opened http://127.0.0.1/1337
-
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/');
- Firebug output:
Aborted – 127.0.0.1 - Windows Firewall disabled – same result.
- Checked netstat:
netstat -na | findstr 1337:
TCP 127.0.0.1:1337 0.0.0.0:0 LISTENING - Checked that Node is running – it was.
- Changed the port – same result.
- Tried to find Node server logs – can’t seem to find any.
Any ideas? Right now I’m kind of baffled that “Hello world” isn’t working (!)
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 😉