error when testing from phone
Answered
Cuckoo wasp posted this in #help-forum
Cuckoo waspOP
Hi,
I am running a react/next app locally on port 3000.
I have a backend also running locally in 8080.
I Can access my react app and backend from phone
ipv4:3000 & ipv4:8080
Both works fine. But when my front end is fetching data from backend, then I can not fetch data when looking from my phone, it works on my laptop!
I am running a react/next app locally on port 3000.
I have a backend also running locally in 8080.
I Can access my react app and backend from phone
ipv4:3000 & ipv4:8080
Both works fine. But when my front end is fetching data from backend, then I can not fetch data when looking from my phone, it works on my laptop!
Answered by Sloth bear
Hey, have you checked the used url for fetching your data from the frontend? It may be something like http://localhost:8080/api/… and localhost is pointing to your phone and not the computer the server is running on? Try to point to the local ip (ex: http://192.168.1.123:8080/api…) when fetching your data from your client. It’s just a guess, it is maybe more complicated than that 🙂
2 Replies
Sloth bear
Hey, have you checked the used url for fetching your data from the frontend? It may be something like http://localhost:8080/api/… and localhost is pointing to your phone and not the computer the server is running on? Try to point to the local ip (ex: http://192.168.1.123:8080/api…) when fetching your data from your client. It’s just a guess, it is maybe more complicated than that 🙂
Answer
Cuckoo waspOP
It helped ! I can now fetch data from the phone 🙂 Thanks alot 
