chore:init project template
This commit is contained in:
20
src/core/throttler/throttler.module.ts
Normal file
20
src/core/throttler/throttler.module.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { Module } from '@nestjs/common'
|
||||
import { ConfigService } from '@nestjs/config'
|
||||
import { ThrottlerModule as NestThrottlerModule } from '@nestjs/throttler'
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
NestThrottlerModule.forRootAsync({
|
||||
inject: [ConfigService],
|
||||
useFactory: (config: ConfigService) => ({
|
||||
throttlers: [
|
||||
{
|
||||
ttl: config.getOrThrow<number>('THROTTLE_TTL'),
|
||||
limit: config.getOrThrow<number>('THROTTLE_LIMIT'),
|
||||
},
|
||||
],
|
||||
}),
|
||||
}),
|
||||
],
|
||||
})
|
||||
export class ThrottlerModule {}
|
||||
Reference in New Issue
Block a user