Support Forums

Getting json data in mobile browser

hey, I have a big problem in showing and getting data in mobile browser(chrome)
I deploy my project to netlify, when I open the link with computer I don’t have any problem in getting data in home page But when I open the link with my mobile browser I cant see any data
I’m using json-server for it (db.json)

Link : https://condescending-galileo-96a1d1.netlify.app/

Hi @Mehdih77

I can get this far in chrome initially.

This is (I believe) to a call somewhere in your code to http://localhost:8888 as stepping through the debugger does load the page.

I get the same error on Chrome desktop too.

I cant understand it! Sometime cant get data in home page, sometime i can get it
30min ago i cant get data in computer browser like you,
But now i try again and i get data

But as shown in your screenshot, your script is trying to load data from http://localhost:8888/products which is not accessible—this is the port Netlify CLI runs on. You need to find that line in your code, change it, and redeploy.

But when I install json-server I should create a port like 8888 for it
how can I change it for deployin for netlify??
This is the code I use for default base url:
REACT_APP_BASE_URL = http://localhost:8888

localhost only runs on your local machine.

According to the npm package details for json-server it is a fake REST API:

Get a full fake REST API with zero coding in less than 30 seconds (seriously)

You cannot run a server on Netlify as per [Support Guide] Can I run a web server, HTTP listener, and/or database at Netlify?