From 8d5725d817c3a66db80af5ac567931f3e4e5719f Mon Sep 17 00:00:00 2001 From: Shannon Lal Date: Tue, 22 Dec 2020 13:12:42 -0500 Subject: [PATCH] Check in simple even exec controller --- examples/README.md | 2 -- .../src/app/controllers/exec.controller.ts | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 examples/apps/rate-limiter-express-app/src/app/controllers/exec.controller.ts diff --git a/examples/README.md b/examples/README.md index ddb6bb5..a648d0f 100644 --- a/examples/README.md +++ b/examples/README.md @@ -22,8 +22,6 @@ NOTE: To be flushed out in more detail. TBD. If this PR is approved will expan ## Points, PointsConsumed, duration and blockDuration -## inmemoryBlockOnConsumed - ## queueEnabled and maxQueueSize ## WhiteList and blackList diff --git a/examples/apps/rate-limiter-express-app/src/app/controllers/exec.controller.ts b/examples/apps/rate-limiter-express-app/src/app/controllers/exec.controller.ts new file mode 100644 index 0000000..d494d7c --- /dev/null +++ b/examples/apps/rate-limiter-express-app/src/app/controllers/exec.controller.ts @@ -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; + } +}