{ N } and LOCALHOST development


#1

Hey there…

My backend is running on http://localhost:3000/.
For android development I am using an emulator created with AndroidStudio (AVD manager).
For ioS development I am using an emulator created with XCode.

What would be the best approach to enable http requests to the localhost in web/ios/android?
I would like to know the best approach to develop for all ‘systems’.

I am asking because I have the following error in android:
System.err: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:3000

Thanks.


#2

You’d need to use a different address to access the local dev machine - 10.0.2.2 is the default.

More info at the SO thread https://stackoverflow.com/a/5806384/6408287


#3

One excellent tool I’ve found to simplify this process is ngrok. It’s a simple command line tool that creates a secure tunnel to your localhost and provides you with https/http connection urls. It even provides live logging for requests to the address.