How could others, on a local network, access my NodeJS app while it's running on my machine?

后端 未结 15 1694
旧时难觅i
旧时难觅i 2020-12-02 07:55

I have a pretty straight-forward question. I made a web game with NodeJS, and I can successfully play it by myself with multiple browser windows open side-by-side; however,

15条回答
  •  臣服心动
    2020-12-02 07:59

    After trying many solution and lot of research I did to the following to make sure my localhost is accessible from other machine in same network. I didn't start my server with IPAddress as parameter to listen method as suggested by others in this question. I did the following to make sure my local node js server is accessible from other machine on same local network. My node server is running in Windows 10 machine.

    1. Open "Windows Defender Firewall with Advanced Security"
    2. Select "Inbound Rules" in the left pane.
    3. In the list of available rules, "Node.js Server-side Javascript" has "Block the connection" radio checked. Change this to "Allow the connection".

    Please see the attached screenshot:

    After these changes, I am able to access my localhost using http://IPAddress:Port/ Thanks.

提交回复
热议问题