Node.js on MAC: Access a Node.js web server from another computer

I built a Node.js web server on my computer, using the so-well-known-http-web-server-example of Node.js:

var http = require('http');

http.createServer(function(req, res){
    res.writeHead(200, {'content-type': 'text/plain'});
    res.end('It works');
}).listen(3000, '127.0.0.1');

This works (as expected) on the computer that runs the server.

I would like to access the server from another computer, in the same LAN. Using ifconfig on the terminal of the computer that runs the server (Apple MacOSX), I get: 192.168.0.6.

So, in my other computer, I opened my browser and connected to http://192.168.0.6:3000, but I get:

Oops! Google Chrome could not connect to 192.168.0.6:3000

My final aim, is to be able to connect to the server using my smartphone.

Any help would be welcome. Don't hesitate to ask for more details if necessary.

Thanks in advance :)

127.0.0.1 is only local interface. Try to start listening all interfaces:

var http = require('http');

http.createServer(function(req, res){
    res.writeHead(200, {'content-type': 'text/plain'});
    res.end('It works');
}).listen(3000, '0.0.0.0');