Trying to setup a node.js web server
I am new to web servers and node.js
and I need some help.
I have no idea what to put in the .listen();
I think since I want it to connect to the internet the server needs to listen to port 80 but but I don't know what to put as the second value.
.listen(80, "What do I add here?");
Also i have a free domain name (www.example.co.cc
) that is pointing to a dynamic dns (DnsExit) since I dynamic ip. I installed to program needed to update my ip开发者_运维知识库 address.
Is there anything I am missing?
Have you seen the example on the homepage of the Node.js project?
- http://nodejs.org/
It clearly demonstrated .listen( 1337, "127.0.0.1" );
and then the next line reads Server running at http://127.0.0.1:1337/
- so the second argument is the IP you want to listen on. If you then take a look at the documentation you will see that this second argument is actually optional, if you omit it, Node.js will accept incoming connections directed at any IPv4 address.
- http://nodejs.org/docs/v0.5.6/api/http.html#server.listen
精彩评论