Skip to content

Commit

Permalink
Update @nestjs/throttler to 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkNjunge committed Oct 3, 2023
1 parent 6f25c03 commit b6a5159
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@nestjs/core": "^10.2.4",
"@nestjs/platform-fastify": "^10.2.4",
"@nestjs/swagger": "^7.1.10",
"@nestjs/throttler": "^4.2.1",
"@nestjs/throttler": "^5.0.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"config": "^3.3.9",
Expand Down
10 changes: 5 additions & 5 deletions src/modules/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import { AppService } from "./app.service";
import { UsersModule } from "../users/users.module";
import { DbModule } from "@/modules/_db/db.module";
import { bool, config } from "@/config";
import { ThrottlerGuard, ThrottlerModule } from "@nestjs/throttler";
import { ThrottlerGuard, ThrottlerModule, seconds } from "@nestjs/throttler";
import { APP_GUARD } from "@nestjs/core";

const modules: DynamicModule[] = [];
const providers: Provider[] = [];

if (bool(config.rateLimit.enabled)) {
modules.push(ThrottlerModule.forRoot({
ttl: config.rateLimit.timeWindow,
limit: config.rateLimit.max,
}));
modules.push(ThrottlerModule.forRoot([{
ttl: seconds(config.rateLimit.timeWindow),
limit: config.rateLimit.max
}]));
providers.push({
provide: APP_GUARD,
useClass: ThrottlerGuard,
Expand Down

0 comments on commit b6a5159

Please sign in to comment.