-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add limiter and change route names
- Loading branch information
Showing
14 changed files
with
132 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
website/app/services/user_service.ts → website/app/services/auth_service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import env from '#start/env' | ||
import { defineConfig, stores } from '@adonisjs/limiter' | ||
|
||
const limiterConfig = defineConfig({ | ||
default: env.get('LIMITER_STORE'), | ||
|
||
stores: { | ||
|
||
/** | ||
* Redis store to save rate limiting data inside a | ||
* redis database. | ||
* | ||
* It is recommended to use a separate database for | ||
* the limiter connection. | ||
*/ | ||
redis: stores.redis({}), | ||
|
||
|
||
/** | ||
* Memory store could be used during | ||
* testing | ||
*/ | ||
memory: stores.memory({}) | ||
}, | ||
}) | ||
|
||
export default limiterConfig | ||
|
||
declare module '@adonisjs/limiter/types' { | ||
export interface LimitersList extends InferLimiters<typeof limiterConfig> {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Define HTTP limiters | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The "limiter.define" method creates an HTTP middleware to apply rate | ||
| limits on a route or a group of routes. Feel free to define as many | ||
| throttle middleware as needed. | ||
| | ||
*/ | ||
|
||
import limiter from '@adonisjs/limiter/services/main' | ||
|
||
export const throttle = limiter.define('global', () => { | ||
return limiter.allowRequests(10).every('1 minute') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters