Reputation: 11609
I am discovering nodejs. So I created a simple file display a simple "hello world!". When I run it in my console, it works just fine. Now I am trying to launch it from the browser (I am listening the 8080 port). But I have an error message, telling me that my browser couldn't find that URL.
I am using MAMP. And, in the root configured with it, I tried to listen the port 8888 (the one that I use launching my PHP local sites, of course changing the port in my nodejs file), but it still doesn't work.
For information, my app.js node file is also in the root directory configured with my MAMP server. Is it a firewall problem? If yes, how can I fix it? Should I change something in my /etc/hosts file?
Upvotes: 1
Views: 480
Reputation: 8063
With node.js you don't need MAMP. Put your app.js file in a folder and run 'node app.js' in the console. This will open a web server usually on port 3000 which you can view in your browser on localhost:3000. There was an excellent talk today from Nuno Job introducing node.js and the differences to MAMP on nodestack today. The recordings will be available soon. Here are some more videos you should have a look at: Introduction to node.js, Node.js Step by Step
Upvotes: 1
Reputation: 11609
In fact, it was indeed a firewall problem, I settled correctly my preferences, and it works just fine !
Upvotes: 1