Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Has the --delay option been removed? #1534

Closed
iiShahad opened this issue Apr 1, 2024 · 11 comments
Closed

Has the --delay option been removed? #1534

iiShahad opened this issue Apr 1, 2024 · 11 comments

Comments

@iiShahad
Copy link

iiShahad commented Apr 1, 2024

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
Copy link

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.

@iiShahad iiShahad closed this as completed Apr 1, 2024
@Bhupender2
Copy link

why it got removed --delay 500 is so useful

@ZakariaBouzouf
Copy link

Could you bring this option it was really usefull

@hamzazubair2713
Copy link

working on version 0.17.4

@ArthurWillameBr
Copy link

This is very necessary

@nileshparwan
Copy link

nileshparwan commented May 28, 2024

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
Copy link

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

@Tasfin660
Copy link

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

@tobi-or-not-tobi
Copy link

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
Copy link

hansas01 commented Jul 5, 2024

npm install -g json-server@0.17.0

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

@thardy
Copy link

thardy commented Jul 25, 2024

I won't be using any version of json-server without a delay option. The removal of this option was a very bad decision. "Just do these extra steps" is never a good answer when we used to be able to bundle the behavior into the api and never think about it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests