json-server icon indicating copy to clipboard operation
json-server copied to clipboard

change homepage path

Open stewartduffy opened this issue 7 years ago • 2 comments

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.

stewartduffy avatar Aug 16 '18 20:08 stewartduffy

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

technbuzz avatar Jan 08 '19 11:01 technbuzz

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.

bitsnaps avatar Mar 04 '24 11:03 bitsnaps