express-simple-throttler
v0.1.4
Published
Simple throttling middleware, slows down requests.
Downloads
117
Maintainers
Readme
Express-Simple-Throttler
Super tiny helper middleware for slowing down requests. Use for your testing.
Install
npm install express-simple-throttler
How-to
The middleware comes in two flavors, constant and random.
Constant
const throttler = require('express-throttler');
const app = require('express')();
const twentySeconds = 20 * 1000;
app.use(throttler(twentySeconds));
// Setup your routes, now they are all super slow
// ...
Random
const throttler = require('express-throttler');
const app = require('express')();
const upToTwentySeconds = 20 * 1000;
app.use(throttler(upToTwentySeconds, true));
// Setup your routes, now some may be super slow
// ...
Tests
Tests are run with jasmine through the test command as follows:
npm test