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/');
This is the Demo from the official website. It has been written above that only the local loopback address is monitored. If you omit the second parameter of listen, you can listen to all addresses.
PS: Another troubleshooting tip:
Using netstat -lnp you can also see whether a program is monitoring 127.0.0.1 or 0.0.0.0.
This is the Demo from the official website. It has been written above that only the local loopback address is monitored. If you omit the second parameter of listen, you can listen to all addresses.
PS: Another troubleshooting tip:
Using
netstat -lnp
you can also see whether a program is monitoring 127.0.0.1 or 0.0.0.0.