javascriptreactjsproxyhttpserverbrunch

How to run Brunch + React on local network


I want share my generated Brunch project on my local network so that I can see how it runs on my mobile devices.

I am trying to do this by running http-server (https://www.npmjs.com/package/http-server) in the public catalogue.

When I navigate to http://127.0.0.1:8080 I see nothing on the page but I do see the generated app.js file but it doesn't run.

How do I share the Brunch project on the local network?


Solution

  • Firstly, make sure both your computer and mobile is on the same network.
    Then, you need to find the IP address of your machine by typing ipconfig in the terminal.
    So for instance if your IP is 192.168.1.100, then you may open the react app (given it is up and running on port 8080) in your phone by going to 192.168.1.100:8080 and not http://127.0.0.1:8080 which is merely a loopback address