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

后端 未结 15 1681
旧时难觅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 08:06

    Faced similar issue with my Angular Node Server(v6.10.3) which set up in WIndows 10. http://localhost:4201 worked fine in localhost. But http://{ipaddress}:4201 not working in other machines in local network.

    For this I updated the ng serve like this

    //Older ng serve in windows command Prompt
    
    ng serve --host localhost --port 4201
    
    //Updated ng serve
    //ng serve --host {ipaddress} --port {portno}
    ng serve --host 192.168.1.104 --port 4201
    

    After doing this modification able to access my application in other machines in network bt calling this url

    http://192.168.1.104:4201  
    //http://{ipaddress}:4201
    

提交回复
热议问题