Skip to content

Commit 7904e69

Browse files
committed
add github example
1 parent 1572436 commit 7904e69

File tree

3 files changed

+9516
-0
lines changed

3 files changed

+9516
-0
lines changed

examples/github.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { parseRateLimit } from 'ratelimit-header-parser'
2+
3+
const response = await fetch("https://api.github.com/repos/express-rate-limit/express-rate-limit/contributors?anon=1&per_page=100", {
4+
"credentials": "omit",
5+
"headers": {
6+
"Accept": "application/vnd.github.v3+json",
7+
},
8+
"method": "GET",
9+
"mode": "cors"
10+
});
11+
12+
console.log( 'github ratelimit:', parseRateLimit(response) );
13+
// > github ratelimit: { limit: 60, used: 1, remaining: 59, reset: 2023-08-25T04:16:48.000Z }

0 commit comments

Comments
 (0)