typicode / json-server

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

Has the --delay option been removed? #1534

Closed iiShahad closed 3 months ago

iiShahad commented 3 months ago

I'm attempting to simulate a delayed response from my server for development purposes using json-server. I used the following command to start the server, intending to introduce a 5000ms delay to responses: json-server --delay 5000 --watch data/cities.json --port 8000

However, when I run this command, I encounter the following error: Unknown option '--delay'

so, has the --delay option been deprecated in the latest versions of json-server?

DiggidyDev commented 3 months ago

It looks like it has been removed, as per the README:

  • use Chrome's Network tab > throtling to delay requests instead of --delay CLI option

And it's no longer listed in the CLI args.

Bhupender2 commented 2 months ago

why it got removed --delay 500 is so useful

ZakariaBouzouf commented 2 months ago

Could you bring this option it was really usefull

hamzazubair2713 commented 2 months ago

working on version 0.17.4

ArthurWillameBr commented 1 month ago

This is very necessary

nileshparwan commented 1 month ago

With the new version, i think, if I understood correctly. You must use the network tab throttling.

image
"db": "json-server --watch db.json --port 3100",
"db:delay": "json-server --delay 3000 --watch db.json --port 3100"
Vector-Green commented 1 month ago

we need delay on server side in some cases, like to simulate queues etc(

Tasfin660 commented 3 weeks ago

I think you can use an older version like npm i json-server@0.17.3

tobi-or-not-tobi commented 2 weeks ago

Network throttling on the browser affects all resources, which is pretty annoying dx, while a delay on the API gives a more realistic experience.

hansas01 commented 5 hours ago

npm install -g json-server@0.17.0

it has been deprecated but with the above install you are good to go