import { MiddlewareConsumer , Module , NestModule } from '@nestjs/common' ; import { CacheModule } from './cache/cache.module' ; import { ConfigService } from './config' ; import { ConfigModule } from './config/config.module' ; import { CorsMiddleware } from './middlewares/cors.middleware' ; import { OriginMiddleware } from './middlewares/origin.middleware' ; import { ApiModule } from './restApi/api.module' ; @ Module ( { imports : [ CacheModule , ConfigModule , ApiModule ] , } ) export class AppModule implements NestModule { constructor ( private configService ) { } configure ( consumer ) { consumer . apply ( CorsMiddleware , OriginMiddleware ) . forRoutes ( '*' ) ; } }