简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM