45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { ConfigModule } from '@nestjs/config';
|
|
import { APP_FILTER, APP_INTERCEPTOR, APP_GUARD } from '@nestjs/core';
|
|
import { ApiModule } from './api/api.module';
|
|
import { KafkaModule } from './infrastructure/kafka';
|
|
import { GlobalExceptionFilter } from './shared/filters/global-exception.filter';
|
|
import { TransformInterceptor } from './shared/interceptors/transform.interceptor';
|
|
import { JwtAuthGuard } from './shared/guards/jwt-auth.guard';
|
|
import { JwtStrategy } from './shared/strategies/jwt.strategy';
|
|
import {
|
|
appConfig,
|
|
databaseConfig,
|
|
jwtConfig,
|
|
redisConfig,
|
|
} from './config';
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule.forRoot({
|
|
isGlobal: true,
|
|
envFilePath: ['.env.development', '.env'],
|
|
load: [appConfig, databaseConfig, jwtConfig, redisConfig],
|
|
}),
|
|
ApiModule,
|
|
KafkaModule,
|
|
],
|
|
providers: [
|
|
JwtStrategy,
|
|
{
|
|
provide: APP_FILTER,
|
|
useClass: GlobalExceptionFilter,
|
|
},
|
|
{
|
|
provide: APP_INTERCEPTOR,
|
|
useClass: TransformInterceptor,
|
|
},
|
|
// Uncomment to enable JWT auth globally
|
|
// {
|
|
// provide: APP_GUARD,
|
|
// useClass: JwtAuthGuard,
|
|
// },
|
|
],
|
|
})
|
|
export class AppModule {}
|