import { resolve } from 'path' ; import { Module , MiddlewareConsumer , RequestMethod } from '@nestjs/common' ; import { TypeOrmModule } from '@nestjs/typeorm' ; import { ScheduleModule } from '@nestjs/schedule' ; import { ConfigModule , ConfigService } from 'nestjs-config' ; import { MailerModule } from '@nest-modules/mailer' ; import { StatusMonitorModule } from 'nest-status-monitor' ; import statusMonitorConfig from './config/statusMonitor' ; import { LoggerMiddleware } from './common/middleware/logger.middleware' ; import { TasksModule } from './tasks/tasks.module' ; import { AudioModule } from './jobs/audio/audio.module' ; import { AuthModule } from './modules/auth/auth.module' ; import { HelloModule } from './modules/hello/hello.module' ; import { ExceptionModule } from './modules/exception/exception.module' ; import { RoleGuardModule } from './modules/role-guard/role-guard.module' ; import { EmailModule } from './modules/email/email.module' ; import { UsersModule } from './modules/users/users.module' ; import { AlbumModule } from './modules/album/album.module' ; @ Module ( { imports : [ ConfigModule . load ( resolve ( __dirname , 'config' , '**/!(*.d).{ts,js}' ) ) , TypeOrmModule . forRootAsync ( { useFactory : ( config ) => config . get ( 'database' ) , inject : [ ConfigService ] , } ) , StatusMonitorModule . setUp ( statusMonitorConfig ) , MailerModule . forRootAsync ( { useFactory : ( config ) => config . get ( 'email' ) , inject : [ ConfigService ] , } ) , AudioModule , AuthModule , HelloModule , ExceptionModule , RoleGuardModule , EmailModule , UsersModule , AlbumModule , ] , } ) export class AppModule { configure ( consumer ) { consumer . apply ( LoggerMiddleware ) . exclude ( { path : 'hello' , method : RequestMethod . POST } ) . forRoutes ( 'hello' ) ; } }