Json-server: 404 error on home page with the 0.16 version using npx

Created on 20 Feb 2020  路  5Comments  路  Source: typicode/json-server

Once switched to 0.16 version stated getting an 404 error in home page using npx:

npx json-server --watch db.json - 404 error when navigating the home page
npx [email protected] --watch db.json - no error

my db.json

{
  "video": [
   {
      "id": "hiOjK992bPU",
      "title": "LINDEMANN - Steh auf (Official Video)",
      "views": "8812123",
      "likes": "219234",
      "dislikes": "4389"
    },
    {
      "id": "NeQM1c-XCDc",
      "title": "Rammstein - Deutschland (Official Video)",
      "views": "88123123",
      "likes": "22543345",
      "dislikes": "75123"
    }
  ]
}

Most helpful comment

@JimiSweden There is an issue if public directory already exists in your project. json-server attempts to serve index.html from there https://github.com/typicode/json-server/issues/1100#issue-578574593

All 5 comments

same issue on windows 10 with VS Code.

I'm able to see the objects but not dashboard(home page)

image

Thanks for the heads-up! It should be good now.

I still have the problem of 404 on the home page, exactly as @oaydinyilmaz reported

using Yarn

node_modules\.bin\json-server -v
0.16.1

windows 10, 
node -v
v13.7.0

@JimiSweden There is an issue if public directory already exists in your project. json-server attempts to serve index.html from there https://github.com/typicode/json-server/issues/1100#issue-578574593

I am afraid this issue still exists.
Please Note:
json-server is version 0.16.1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TXRRNT picture TXRRNT  路  4Comments

melnikovic picture melnikovic  路  3Comments

casvil picture casvil  路  4Comments

boydenhartog picture boydenhartog  路  3Comments

0plus1 picture 0plus1  路  3Comments