https://github.com/thorwebdev/supamuenchenfest-game
https://github.com/thorwebdev/supamuenchenfest-game
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/thorwebdev/supamuenchenfest-game
- Owner: thorwebdev
- Created: 2022-03-18T08:56:27.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-18T10:36:55.000Z (about 4 years ago)
- Last Synced: 2024-10-05T12:24:46.642Z (over 1 year ago)
- Language: JavaScript
- Homepage: supamuenchenfest-game.vercel.app
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# API Routes Rate Limiting Example
This example uses `lru-cache` to implement a simple rate limiter for API routes ([Serverless Functions](https://vercel.com/docs/serverless-functions/introduction)).
**Demo: https://nextjs-rate-limit.vercel.app/**
```bash
curl http://localhost:3000/api/user -I
HTTP/1.1 200 OK
X-RateLimit-Limit: 10
X-RateLimit-Remaining: 9
curl http://localhost:3000/api/user -I
HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 10
X-RateLimit-Remaining: 0
```
## Deploy your own
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/api-routes-rate-limit)
[](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/api-routes-rate-limit&project-name=api-routes-rate-limit&repository-name=api-routes-rate-limit)
## How to use
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
```bash
npx create-next-app --example api-routes-rate-limit api-routes-rate-limit-app
# or
yarn create next-app --example api-routes-rate-limit api-routes-rate-limit-app
```
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).