简体   繁体   中英

How do I setup my Node.js server so clients can connect?

My little node.js server works fine, but only the host machine is able to connect with it. When i try to connect with other clients (which are connected to the same router as the host), I don't get a response. The server is listening at port 3000 (also tried 80, no difference), I tried setting the host ip to the network ip of the host computer, 127.0.0.1 and left it empty, but nothing worked. How do i configure my server so that clients other than the host may connect?

127.0.0.1 is your local IP

if you are using wamp or mamp share your server on ip.

Next go on google check for whatsmyip . Give your ip adress to who you want to share your file.

Or if you consider to upload on server

except node_modules you have to upload the necessary files and folders. In server try npm install .

Make sure you have package.json

If you are new to Nodejs . Try Heroku

https://scotch.io/tutorials/how-to-deploy-a-node-js-app-to-heroku

  1. Set the listen IP to 0.0.0.0. This listens on every interface.
  2. Turn off your firewall to check that it is not the issue. When you turn it back on, allow port 3000 TCP incoming and outgoing.

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