Skip to content

Commit

Permalink
fix: add rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanyawat-Arsaga committed Nov 22, 2023
1 parent ee632ec commit 87091f8
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@nestjs/platform-fastify": "^10.2.10",
"@nestjs/schedule": "^4.0.0",
"@nestjs/swagger": "^7.1.16",
"@nestjs/throttler": "^5.0.1",
"@nestjs/typeorm": "^10.0.1",
"axios": "^1.6.2",
"canvas": "^2.11.2",
Expand Down
36 changes: 36 additions & 0 deletions pnpm-lock.yaml

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

17 changes: 17 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Module } from '@nestjs/common';
import { ThrottlerModule } from '@nestjs/throttler';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { ScheduleModule } from '@nestjs/schedule';
import { TypeOrmModule } from '@nestjs/typeorm';
Expand All @@ -25,6 +26,7 @@ import { RssModule } from './modules/rss/rss.module';
import { SchedulerModule } from './modules/scheduler/scheduler.module';
import { WanikaniModule } from './modules/wanikani/wanikani.module';


@Module({
imports: [
DiscordModule,
Expand All @@ -46,6 +48,21 @@ import { WanikaniModule } from './modules/wanikani/wanikani.module';
D4DJModule,
AibouModule,
JishoModule,
ThrottlerModule.forRoot([ {
name: 'short',
ttl: 1000,
limit: 3,
},
{
name: 'medium',
ttl: 10000,
limit: 20
},
{
name: 'long',
ttl: 60000,
limit: 100
}]),
TypeOrmModule.forRoot({
type: 'sqlite',
database: '../files/database.db',
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"esModuleInterop": true,
"target": "es6",
"jsx": "preserve",
"lib": ["esnext"],
"lib": ["dom", "dom.iterable", "esnext"],
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
Expand Down

0 comments on commit 87091f8

Please sign in to comment.