Call a locally hosted server from Expo

1.1k Views Asked by At

I have followed this great blog post: How to call a locally hosted server from Expo?

However I get stuck at the next step:

The above command will return a URL accessible across Internet of the form https://application-mock-server.localtunnel.me. This URL can be plugged inside the React Native code base and will be accessible from the application running inside Expo on the mobile.

I have tried to figure out how to "plug the localtunnel URL inside the React Native code base". I thought that it would be "homepage" in "package.json", but so far no luck. Can you please help?

2

There are 2 best solutions below

0
Mudassar hassan On

You need to specify that URL where you are sending API request. If you have not created a separate file, you can create apiConfig.js file or any similar named file and export that URL from the file and reference where ever you need to call the backend API.

1
ItFlyingStart On

Never mind. I haven't noticed this "tunnel" option until now, which does the trick.

enter image description here