How to open http on expo react native app
I’m designing an Android app using Expo. I’m struggling with opening a localhost port on the app to create a local API route on the Android device itself. Could you please help me with this? Thank you.
How to open http on expo react native app
I’m designing an Android app using Expo. I’m struggling with opening a localhost port on the app to create a local API route on the Android device itself. Could you please help me with this? Thank you.
2
Answers
Update Expo configuration:
You need to specify the IP address and port of your local server in the Expo configuration. This can be done in your app.json or app.config.js file.
Update your API calls:
Update the API endpoint URLs in your React Native code to use the IP address and port of your local server.
const API_URL = ‘http://<YOUR_LOCAL_IP_ADDRESS>:/api’;
Configure your local server:
ive suferd from this befor,all u had to do is to change your sever localhost to be the same as mobile and mustt be your network localhost,for example from your pc go to your connected wifi settings and show details you will find wifi localhost that you must run ur sever and api with it.
enter image description here