### File

`src/infrastructure/modules/app.module.ts`

### Description

application module

### Imports

- CommonModule
- SearchModule

    import { CacheInterceptor, CacheModule, Module } from '@nestjs/common';
    import { APP_INTERCEPTOR } from '@nestjs/core';
    import { ConfigModule } from '@nestjs/config';
    import { configuration } from '../config/env.objects';
    import { validate } from '../config/env.validation';
    import { LoggerInterceptor } from '../../core/interceptors'
    import * as modules from '../../core/modules'
    import { CommonModule } from './common/common.module';
    import { PrometheusModule } from '@willsoto/nestjs-prometheus';
    import { SearchModule } from './search.module';

    /**
     * application modules list
     */
    const modulesList = Object.keys(modules).map(moduleIndex => modules[moduleIndex as keyof typeof modules]);

    /**
     * application module
     */
    @Module({
      imports: [
        SearchModule,
        PrometheusModule.register(),
        CacheModule.register(),
        CommonModule,
        ConfigModule.forRoot({
          load: [configuration],
          validate,
          isGlobal: true,
          cache: true,
          expandVariables: true,
        }),
        ...modulesList,
      ],
      providers: [
        {
          provide: APP_INTERCEPTOR,
          useClass: CacheInterceptor,
        },
        {
          provide: APP_INTERCEPTOR,
          useClass: LoggerInterceptor,
        },
      ],
      controllers: [],
    })
    export class AppModule {}

# results matching ""

# No results matching ""