Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boo1ean/express-delay
Delay express responses
https://github.com/boo1ean/express-delay
Last synced: 30 days ago
JSON representation
Delay express responses
- Host: GitHub
- URL: https://github.com/boo1ean/express-delay
- Owner: boo1ean
- Created: 2014-09-26T11:42:53.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-10-17T19:36:14.000Z (about 5 years ago)
- Last Synced: 2024-09-21T09:11:41.900Z (about 2 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 17
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
express-delay
=============Delay express responses
## Use case
You want to test your fancy ajax loaders, spinners and stuff, but your dev machine is too damn fast for that shit!
## Usage
```javascript
var app = require('express')();
var delay = require('express-delay');// Delay all responses for 1 second
app.use(delay(1000));// Response will be delayed for 1 second
app.get('/', function(req, res) {
res.send('Hello world!');
});// ...
```### Random delay
You can also give it a range of values, which will make the delay random:
```javascript
// Delay will be between 200 and 500 milliseconds
app.use(delay(200, 500));
```## LICENSE
MIT