Skip to content

Commit

Permalink
feat: testing rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
rayriffy committed Mar 8, 2023
1 parent 303ac4e commit a8a9287
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Binary file modified bun.lockb
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"@elysiajs/cors": "^0.1.0",
"@elysiajs/swagger": "^0.2.0-rc.0",
"cheerio": "^1.0.0-rc.12",
"elysia": "^0.2.0-rc.0"
"elysia": "^0.2.0-rc.0",
"elysia-rate-limit": "^1.0.1"
},
"devDependencies": {
"bun-types": "latest"
Expand Down
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import { Elysia, t } from 'elysia'
import { cors } from '@elysiajs/cors'
import { swagger } from '@elysiajs/swagger'
import { rateLimit } from 'elysia-rate-limit'

import { getList } from './functions/getList'
import { getLotto } from './functions/getLotto'
import { model } from './models'

const app = new Elysia()
.use(cors())
.use(
rateLimit({
duration: 60 * 60 * 1000, // 1 hour
max: 500, // 500 req per hour
})
)
.use(
swagger({
exclude: ['/', '/ping'],
Expand Down

0 comments on commit a8a9287

Please sign in to comment.