typicode / json-server

Get a full fake REST API with zero coding in less than 30 seconds (seriously)
Other
72.66k stars 7.01k forks source link

change homepage path #836

Open stewartduffy opened 6 years ago

stewartduffy commented 6 years ago

Is there a way to configure so it will always return the default index file? Regardless if there is a ./public directory?

I am having an issue when using this with create react app which ships with a .public directory that it serves the react app from. Problem is when I run this with json-server, it sees the public dir then tries to serve that, thus not serving the default home page.

technbuzz commented 5 years ago

I have the same problem with Vuejs as the .public directory is already used. The quick fix is to server db.json somewhere else.

bitsnaps commented 7 months ago

I would suggest to customize the root path in the routes.json custom routes as follows:

{
  "/": "/books"
}

Sadly this wont work unless you create the empty dir: public.