I'm trying to fetch a locally hosted API from ASP.NET server:
try {
const response = await fetch(`https://localhost:2318/api/Restaurant`)
const data = await response.json()
console.log(data)
} catch (error) {
console.error(error)
}
However, it throws an error:
Network request failed
at node_modules/whatwg-fetch/dist/fetch.umd.js:535:17 in setTimeout$argument_0
None of my endpoints work. Fetching from public APIs works. Also strange that opening the fetching url https://localhost:2318/api/Restaurant in Safari inside the simulator works and returns the data as expected.
I'm using Expo v42.0.1, RN v0.66.
Any ideas?