leaonline:ratelimit-factory

v1.0.0Published last year

Ratelimit Factory

JavaScript Style Guide Project Status: Active – The project has reached a stable, usable state and is being actively developed. GitHub file size in bytes GitHub

Rate-limit methods and publications. Lightweight. Simple.

All code is ~200 lines and includes a full registry class to handle register and running the rate limiter.

Install and import

$ meteor add leaonline:ratelimit-factory

Then import the specific functions via

1import { 
2  runRateLimiter,
3  rateLimitMethod,
4  rateLimitMethods,
5  rateLimitPublication,
6  rateLimitPublications, 
7  rateLimitAccounts } from 'meteor/leaonline:ratelimit-factory'

You can simply omit the functions you don't need.

Usage

You can use these functions to rate limit all Methods and Publications on your Meteor backend. After you have added all Methods/Publications, you can execute the rate limier using runRateLimiter and pass a callback function which is executed on limit exceeded.

For a detailed usage, you can lookup the API documentation

License

MIT, see license file