I am using npm
I used below code in gitbash
npm run json-server --watch db.json
Then I checked my localhost:3000, it showing cannot get.
Although after running the command it display the following
\{^_^}/ hi!
Loading db.json
Done
Resources
http://localhost:3000/todos
Home
http://localhost:3000
Type s + enter at any time to create a snapshot of the database
Watching...
Try launch without npm on begining:
json-server --watch db.json
command not found
Are you install this package globally?
yeah
I don't think you installed it globally, but anyway, you can run it with
npx json-server db.json --watch
Ok. npm is not for runing json-server or any package is for install and launch scripts from package.json.
npm install -g json-serverhttp://localhost:3000/todos. If you open just http://localhost:3000 you get a blank page--port 3030db.json @sahilkatia Is your issue fixed? Shall we close the ticket?
What is the use of npx front of json-server db.json --watch
because json-server --watch db.json doesn't work with me
npx json-server public/db.json --port 8000 worked for me
Most helpful comment
I don't think you installed it globally, but anyway, you can run it with