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

Has the --delay option been removed?

Open itshahad opened this issue 2 years ago • 49 comments

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?

itshahad avatar Apr 01 '24 14:04 itshahad

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.

DiggidyDev avatar Apr 01 '24 17:04 DiggidyDev

why it got removed --delay 500 is so useful

Bhupender2 avatar Apr 08 '24 12:04 Bhupender2

Could you bring this option it was really usefull

ZakariaBouzouf avatar Apr 12 '24 11:04 ZakariaBouzouf

working on version 0.17.4

hamzazubair2713 avatar May 05 '24 19:05 hamzazubair2713

This is very necessary

ArthurWillameBr avatar May 21 '24 16:05 ArthurWillameBr

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"

nileshparwan avatar May 28 '24 08:05 nileshparwan

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

Vector-Green avatar May 30 '24 10:05 Vector-Green

I think you can use an older version like npm i [email protected]

Tasfin660 avatar Jun 09 '24 16:06 Tasfin660

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

tobi-or-not-tobi avatar Jun 19 '24 07:06 tobi-or-not-tobi

npm install -g [email protected]

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

hansas01 avatar Jul 05 '24 04:07 hansas01

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.

thardy avatar Jul 25 '24 20:07 thardy

please rollback delay option.

vinaciotm avatar Sep 08 '24 03:09 vinaciotm

+1 for doing a rollback of the delay option. It was one of the main features. I don't know how it seemed reasonable to remove such a helpful feature like this one.

Gustavo-Cauzzi avatar Sep 16 '24 14:09 Gustavo-Cauzzi

+1

fandredev avatar Sep 23 '24 22:09 fandredev

Rollback this option please

tobiaszciesielski avatar Sep 24 '24 14:09 tobiaszciesielski

Yeah, it would be nice to have that delay feature. It was optional; why not keep it?

ggteixeira avatar Sep 24 '24 22:09 ggteixeira

using chrome's throttling option is NOT the same as using json-server delay option, sometimes we just need the delay to come from the server and not for all resources requested by the browser.

why not leave it optional?

hugodemelo avatar Sep 29 '24 14:09 hugodemelo

Damn can't believe they did this lol. Was very helpful :(

stackanthony avatar Sep 29 '24 23:09 stackanthony

+1

sysmat avatar Oct 27 '24 14:10 sysmat

+1

rbpolim avatar Nov 11 '24 19:11 rbpolim