0.1.4 • Published 6 years ago

express-simple-throttler v0.1.4

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Express-Simple-Throttler

npm version CircleCI Coverage Status

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