hapi-api-rate-limit
v1.0.0
Published
Redis api rate limit plugin for hapi
Downloads
2
Maintainers
Readme
hapi-api-rate-limit
Redis api rate limit plugin for hapi
Usage
To use default settings simply write:
var Hapi = require('hapi');
var server = new Hapi.Server();
server.pack.register(require('hapi-api-rate-limit'), function (err) {
// plugin is loaded
});
If you want to overwrite the default settings:
var Hapi = require('hapi');
var server = new Hapi.Server();
var options = {
interval: 10, // seconds
requestLimit: 1 // 1 request per interval
};
server.pack.register({
plugin: require('hapi-api-rate-limit'),
options: options
}, function (err) {
// plugin is loaded
});
License
MIT