Dev environment for iPhone/browser


I acknowledge this is somewhat unrelated to Ionic, but perhaps some folks here have figured this out.

The setup is that my angular app is running on localhost port:9000 and it is contacting my dev API on localhost:3000. I can look up my network IP and tell my phone to access that port, but when it tries to contact localhost to access the API the request fails. Hardcoding the IP in the dev config works, but since it changes I obviously don’t want that in my repo.

What’s the best option?


I hope I understood this correct:
http API is on :3000, another Service is on :9000 you are loading :9000 on your phone. What did you put in the URL? localhost? If this is the case, your phone needs the IP address of your computer, because the phone actually tries to contact its very own localhost.

The best option for your dev environment is a vm with its own network, Maybe you could look at Vagrant to setup a production like dev environment. It uses headless VirtualBox and saves much memory on your dev machine.