Skip to content

Connect middleware for adding a random delay to responses

License

Notifications You must be signed in to change notification settings

isabella232/connect-lag

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

connect-lag

Connect middleware for adding a random delay to responses

Installation

For now, you can point your package.json file at this repository:

{
  "name": "cool-app",
  "dependencies": {
    "connect-lag": "git://github.com/localdata/connect-lag.git"
  }
}

Use

There are some examples in the examples folder, but roughly:

var connect = require('connect');
var lag = require('connect-lag');

var app = connect()
.use(lag({
  min: 250,
  max: 750
}))
.listen(process.env.PORT || 3000);

Why?

Sometimes we develop/test on our local machines, and things are just a little too snappy. This middleware helps us simulate an actual network connection without having to set up a separate proxy. It's not totally accurate, of course, since it modifies the server behavior and doesn't slow down each packet uniformly.

About

Connect middleware for adding a random delay to responses

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%