lwsjs / local-web-server

A lean, modular web server for rapid full-stack development.
MIT License
1.21k stars 85 forks source link

Feature request: delay response #26

Closed Kordonme closed 8 years ago

Kordonme commented 8 years ago

Is it possible to delay responses in some way? I tried implementing koa-slow, but no luck. Still instant response.

It would be cool to be able to implement some sort of delay for mocks. Maybe even with the use of a function, so that I can write my random delay e.g. between 50 and 1500 ms.

I'm not sure of that's out of scope for this project, maybe you have some other ideas?

75lb commented 8 years ago

good point, thanks!

fixed in v1.1.. you can make your mocked response async by returning a Promise.. see this example - you can substitute the 2s delay for something random..