Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leaonline/ratelimit-factory
Rate-limit methods and publications. Lightweight. Simple.
https://github.com/leaonline/ratelimit-factory
hacktoberfest meteor meteor-methods meteor-publications meteorjs
Last synced: 7 days ago
JSON representation
Rate-limit methods and publications. Lightweight. Simple.
- Host: GitHub
- URL: https://github.com/leaonline/ratelimit-factory
- Owner: leaonline
- License: mit
- Created: 2020-05-15T19:20:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-22T09:53:58.000Z (over 4 years ago)
- Last Synced: 2024-11-15T16:12:28.080Z (2 months ago)
- Topics: hacktoberfest, meteor, meteor-methods, meteor-publications, meteorjs
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ratelimit Factory
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
![GitHub file size in bytes](https://img.shields.io/github/size/leaonline/ratelimit-factory/ratelimit-factory.js)
![GitHub](https://img.shields.io/github/license/leaonline/ratelimit-factory)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
```bash
$ meteor add leaonline:ratelimit-factory
```Then import the specific functions via
```javascript
import {
runRateLimiter,
rateLimitMethod,
rateLimitMethods,
rateLimitPublication,
rateLimitPublications,
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](./API.md)
## License
MIT, see [license file](./LICENSE)