forked from Cylo-Traders/Agrocylo-PIP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.module.ts
More file actions
47 lines (46 loc) · 1.33 KB
/
Copy pathapp.module.ts
File metadata and controls
47 lines (46 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Module } from '@nestjs/common';
import { APP_GUARD } from '@nestjs/core';
import {
ConfigModule as NestConfigModule,
ConfigService,
} from '@nestjs/config';
import { ThrottlerGuard, ThrottlerModule } from '@nestjs/throttler';
import { ConfigModule } from './config/config.module';
import { LoggerModule } from './common/logger/logger.module';
import { HealthModule } from './modules/health/health.module';
import { IndexerModule } from './indexer/indexer.module';
import { DatabaseModule } from './database/database.module';
import { WebsocketModule } from './websocket/websocket.module';
/**
* Root application module. Feature modules are registered here as the platform
* grows (e.g. database, indexer, websocket gateways).
*/
@Module({
imports: [
ConfigModule,
LoggerModule,
ThrottlerModule.forRootAsync({
imports: [NestConfigModule],
inject: [ConfigService],
useFactory: (config: ConfigService) => ({
throttlers: [
{
ttl: config.get<number>('throttle.ttlMs') ?? 60000,
limit: config.get<number>('throttle.limit') ?? 100,
},
],
}),
}),
HealthModule,
DatabaseModule,
WebsocketModule,
IndexerModule,
],
providers: [
{
provide: APP_GUARD,
useClass: ThrottlerGuard,
},
],
})
export class AppModule {}