Installations
npm install koa-redis-ratelimit
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>= 6.x
Node Version
6.3.1
NPM Version
3.10.3
Score
70.9
Supply Chain
98.3
Quality
74.4
Maintenance
50
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Download Statistics
Total Downloads
1,613
Last Day
2
Last Week
3
Last Month
7
Last Year
52
GitHub Statistics
3 Stars
3 Commits
1 Forks
1 Watching
2 Branches
10 Contributors
Bundle Size
15.26 kB
Minified
5.44 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.1
Package Id
koa-redis-ratelimit@1.0.1
Size
21.68 kB
NPM Version
3.10.3
Node Version
6.3.1
Total Downloads
Cumulative downloads
Total Downloads
1,613
Last day
0%
2
Compared to previous day
Last week
200%
3
Compared to previous week
Last month
133.3%
7
Compared to previous month
Last year
-31.6%
52
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
koa-redis-ratelimit
Rate limiting middleware backed by Redis for Koa v2+, built for CrocodileJS.
Install
1npm install --save koa-redis-ratelimit
Usage
1import RateLimit from 'koa-redis-ratelimit'; 2import redis from 'redis'; 3import Koa from 'koa'; 4 5const app = new Koa(); 6 7// apply rate limit 8app.use(new Ratelimit({ 9 db: redis.createClient(), 10 duration: 60000, 11 max: 100, 12 id: (ctx) => ctx.ip, 13 blacklist: [], 14 whitelist: [] 15}).middleware); 16 17// response middleware 18app.use(ctx => { 19 ctx.body = 'Stuff!'; 20}); 21 22app.listen(3000); 23console.log('listening on port 3000');
Options
db
- redis connection instancemax
- max requests withinduration
(default is2500
)duration
- of limit in milliseconds (default is3600000
)id
- id to compare requests [ip]whitelist
- array of ids to whitelistblacklist
- array of ids to blacklist
Responses
Example 200 with header fields:
1HTTP/1.1 200 OK
2X-Powered-By: koa
3X-RateLimit-Limit: 100
4X-RateLimit-Remaining: 99
5X-RateLimit-Reset: 1384377793
6Content-Type: text/plain; charset=utf-8
7Content-Length: 6
8Date: Wed, 13 Nov 2013 21:22:13 GMT
9Connection: keep-alive
10
11Stuff!
Example 429 response:
1HTTP/1.1 429 Too Many Requests
2X-Powered-By: koa
3X-RateLimit-Limit: 100
4X-RateLimit-Remaining: 0
5X-RateLimit-Reset: 1384377716
6Content-Type: text/plain; charset=utf-8
7Content-Length: 39
8Retry-After: 7
9Date: Wed, 13 Nov 2013 21:21:48 GMT
10Connection: keep-alive
11
12Rate limit exceeded, retry in 8 seconds
License
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/ladjs/.github/SECURITY.md:1
- Info: Found linked content: github.com/ladjs/.github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/ladjs/.github/SECURITY.md:1
- Info: Found text in security policy: github.com/ladjs/.github/SECURITY.md:1
Reason
Found 0/3 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3.9
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More