Hi
Created a very basic app with a PostgreSQL database hosted on Render. The app works as it should if accessed via a desktop browser, but cannot retieve the database data when accessed via a mobile device.
Did a screenshot of mobile debug (see attached). Comes back with a ‘Connection Refused’ error, but it works correctly on the desktop?
I tried fetching with the URL as well, but it doesnt help:
// Fetch items from the backend
useEffect(() => {
fetch(“http://localhost:5000/api/items”)
.then((response) => response.json())
.then((data) => setItems(data))
.catch((error) => console.error(“Error fetching data:”, error));
}, );
I cannot see why it should be different for a mobile device. I get the error when the mobile device is connected to the same network as the desktop (while the desktop works fine), as well as when the mobile device is on mobile data.
Any suggesstions would be appreciated.
Thanks