tunnckoCore / express-better-ratelimit

Express.js request rate limiter
http://j.mp/1stW47C
Other
10 stars 0 forks source link

better-ratelimit NPM version Build Status Dependency Status Coveralls

Express.js request rate limit middleware by IP with MemoryStore

upcoming v2 soon

Install Nodei.co stats

Install with npm

$ npm install express-better-ratelimit
$ npm test

This package follows ferver

Please read history.md for more info!

Usage

Some demo example which is exactly example.js

var express = require('express');
var limit = require('./index');

var app = express();

app.use(limit({
  duration: 30000, //30 seconds
  max: 5
  //blackList: ['127.0.0.1']
}));

app.use(function helloWorld(req, res, next) {
  res.set('Content-Type', 'text/plain');
  res.status(200).send('Hello world');
  next();
});

var port = process.env.PORT || 3333;
app.listen(port);
console.log('Express server start listening on port %s', port);
console.log('Type few times: curl -i http://localhost:%s', port);

.expressBetterRatelimit

With options through init you can control black/white lists, limit per ip and reset interval.

Authors & Contributors

Charlike Make Reagent author tips

License MIT license

Copyright (c) 2014 Charlike Make Reagent, contributors.
Released under the MIT license.