I am trying to make a request to my API (Node.JS) from the front-end (react-native) using Axios. But I am confused about the error I get. Here\'s the print stack trace of the er
ANSWER :
Alright, after few hours working on that bug, I found the answer by my self. The thing is that my server Node.js
is running on my PC and I am testing my app with Expo
on my cellphone. I was calling the server from the front-end with Axios
with url http://localhost:3001/login
. As I can't reach localhost of my PC with my cellphone, I had to change the url for the IP address of my PC, http://192.168.0.123:3001/login
.
Here's how to get your IP address of your PC : Calling locally hosted server from Expo App
Here's a similar problem : Axios (in React-native) not calling server in localhost
Hope it can help someone in the future with a similar bug.