If I try to get datas from my local server with the whole url, it works:
fetch("http://192.168.xxx.xxx:3000/members")
.then((response) => {
return response.json();
})
.then((myJson) => {
console.log(myJson);
})
output:
{"members": ["Members1", "Member2", "Member3"]}
but if I’m setting a proxy in my package.json, it doesn’t:
"proxy":"http://192.168.xxx.xxx:3000/",
fetch("/members")
.then((response) => {
return response.json();
})
.then((myJson) => {
console.log(myJson);
})
output:
TypeError: Network request failed
I have read somewhere that it’s not possible to set up a proxy in react native ?
So does the good way to do is to set a constant that I call each time?
For add some details:
I use expo and start it like this: npx expo start --dev-client --tunnel