title: Connect a Nativescript mobile app with a local api server
body: <p>So I'm running into what's probably a typical issue and although there seems to be several related questions and answers <a href="https://stackoverflow.com/questions/43150805/developing-nativescript-app-with-local-api">here</a> and <a href="https://stackoverflow.com/questions/56148070/nativescript-localhost-http-call-fails-on-ios">here</a> but they don't exactly apply to my question.</p>
  
  <p>I have a local django server (localhost:8000) running in development.
  I would like to easily develop a Nativescript mobile app connecting to my django server by using Nativescript/Vue with Axios to make the http calls. I prefer to start development/testing in ios.  I have two choices for development with Nativescript - either using 'tns run ios' which brings up the ios emulator on my mac or using 'tns preview' which allows me to test via my actual iphone.</p>
  
  <p>When I am making a basic call via axios to <a href="http://localhost:8000/myapi" rel="nofollow noreferrer">http://localhost:8000/myapi</a> that call yields an http status result of null.</p>
  
  <ul>
  <li>I tried using a loopback address (e.g., 10.0.2.2 - which I believe may work for the Android emulator) but that yielded the same result.</li>
  <li><p>I tried using my local IP address of my mac - i.e., instead of localhost, using my local 192.168.xx.xx address for the call but that didn't work</p></li>
  <li><p>I finally was able to get it working using ./ngrok to tunnel my local server to an outside IP address.  Now that works, but it's not ideal since that IP address may change from time to time.  </p></li>
  </ul>
  
  <p>What is the suggested solution for easily connecting to my local api server using either Nativescript preview or running the ios emulator?</p>