timothymiller / t4-app

Full stack meta-framework for building iOS, Android, and Progressive Web Apps with Tamagui and deploying to Cloudflare.
https://t4stack.com
MIT License
1.49k stars 84 forks source link

Update API package.json to allow wrangler to run on actual localhost #160

Closed NikAtNight closed 4 months ago

NikAtNight commented 4 months ago

Issue

When running your expo app and trying to connect to localhost via an app simulator, the simulator itself has no localhost access.

Updating your API URL to use your devices local ip address still does not work as wragler dev runs on localhost which you would think it would be associated with 127.0.0.1, or 0.0.0.0 or you devices IP address but it does not. It is strictly localhost

This proposed change allows it to run on all local ip address which will allow the EXPO_PUBLIC_API_URL to actually work.

Also without this proposed change all you get on your TRCP calls is this

WARN  [TRPCClientError: Network request failed]

With the proposed change you can get this

[wrangler:inf] Ready on http://0.0.0.0:8787
[wrangler:inf] - http://127.0.0.1:8787
[wrangler:inf] - http://10.0.0.135:8787
[wrangler:inf] - http://192.168.64.1:8787
[wrangler:inf] - http://10.0.0.21:8787
[wrangler:inf] GET /trpc/hello.world,auth.secretMessage 207 Multi-Status (25ms)
[wrangler:inf] GET /trpc/auth.secretMessage 401 Unauthorized (12ms)