DEV Community

Elson Jose
Elson Jose

Posted on

How to serve angular app to all devices connected to your router ?

Sometimes you might need to see how your site functions on another actual device. Follow these steps to learn how you can do that on angular.

  1. Find the IP address assigned by your router to the device on which you are planning to serve the angular app. Use the following commands based on you operating systems.
    $ ifconfig // for linux
    $ ipconfig // for windows
    In the results you can look for inet followed by the IP address assigned by your router to the device.

  2. Then using that IP address use the following command to serve the angular application.
    $ ng s --host=<YOUR_IP_ADDRESS_HERE> --port=<PORT_NUMBER>
    You can replace YOUR_IP_ADDRESS_HERE with the result from step 1 and PORT_NUMBER with any available port number.

  3. On another device connected to the same router, type the address https://<YOU_IP_ADDRESS_HERE>:<PORT_NUMBER>

Voilà....thats it.

Top comments (0)