Iam working on a project of “Restaurants” and wanted a fake api so i installed json-server in my repl. Now when i ran the “json-server --watch db.json”, and in db.json i have a json data on restaurants and genres, i got a successfull message listing the port links “http//localhost:3000/restaurants” and “http//localhost:3000/genres”, but now when i open this links in my browser iam getting “this site cant be reached” error. how do i acces my db.json data with restaurants and genres? please help me iam struggling with this past 5 days.
What is written below will only work if you use Replit!
The localhost link will only work on the device on which the local server was started. On Replit, the site server runs on Replit computers, which means that the link that is displayed in your console will work only if it is opened from the Replit server, which is impossible for you.
Instead of following the link that appears in the console, you can click on the New tab button in the upper right corner of the webview window. Then a page with your site will open. It is important to note that after January 1 next year, this link will only work when you are in the editor.
Hi @atikinivris !
You repl can open in a new tab (I clicked the button in the Cover Page) and I went to this link: https://platter.atikinivris.repl.co/
Your repl seems to be working fine. In the repl, got to the Webview tab and you can see the output from there.
Hope this helps!
I am able to open my repl in the new tab… But what iam asking is… I want to start my json server and watch the db.json file… That runs on http//localhost:5000/restaurants and similarly for generes… I want to access this end points.
Will i be able to do a post request to the separate files?.. Will the files will be written if i do post request?
Becauss the main issue is with the post request only… I created a normal .json file without json server and tried post request on it using axios, but the file was not getting written with the new data… That was the main problem