This repository has been archived by the owner on Nov 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check in simple even exec controller
- Loading branch information
1 parent
92e8f71
commit 8d5725d
Showing
2 changed files
with
19 additions
and
2 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
19 changes: 19 additions & 0 deletions
19
examples/apps/rate-limiter-express-app/src/app/controllers/exec.controller.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Controller, Get } from '@nestjs/common'; | ||
|
||
import { AppService } from '../services/app.service'; | ||
import { RateLimit } from '../../../../../../dist'; | ||
|
||
@Controller('exec') | ||
export class ExecEvenlyController { | ||
constructor(private readonly appService: AppService) {} | ||
|
||
@RateLimit({ | ||
points: 1, | ||
duration: 5, | ||
errorMessage: 'Execeed maximum number of requests' }) | ||
@Get('/evenly') | ||
async getExecEvenly() { | ||
const resp = await this.appService.getData(); | ||
return resp; | ||
} | ||
} |