How to get localhost to work in Snack Expo?

#1

I have been trying to implement the Fetch API to simply get JSON data from my localhost URL.

However, the JSON data does not load through the localhost. I copied the data from the localhost URL into a JSON placeholder website (myjson.com) to test with a different URL. It contained the exact same data as the localhost URL but was able to load correctly.

Is there a way to get localhost to work in Snack Expo?

#2

Hey @caluminium,

You’ll have to use Ngrok or something similar to expose your computer to the internet. This isn’t related to Expo in particular but general networking.

Cheers,
Adam

#3

Thanks Adam, this worked after downloading ngrok to change my localhost URL into an ngrok.io URL.

1 Like
#4

Glad to hear you got it up and running!

closed #5

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.