How to use @nestjs/config - 1 common examples

To help you get started, we’ve selected a few @nestjs/config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CatsMiaow / node-nestjs-structure / src / app.module.ts View on Github external
import { RouterModule } from 'nest-router';

import { AWSModule } from './aws/aws.module';
import { BaseModule } from './base/base.module';
import { CommonModule } from './common/common.module';
import { ExceptionsFilter } from './common/filters';
import { AuthenticatedGuard } from './common/guards';
import { LoggerMiddleware } from './common/middleware';
import { configuration } from './config';
import { SampleModule } from './sample/sample.module';

@Module({
  imports: [
    // Configuration
    // https://docs.nestjs.com/techniques/configuration
    ConfigModule.forRoot({
      isGlobal: true,
      load: [configuration]
    }),
    // Database
    // https://docs.nestjs.com/techniques/database
    TypeOrmModule.forRootAsync({
      useFactory: async (config: ConfigService) => ({
        entities: [`${__dirname}/entity/**/*.{js,ts}`],
        subscribers: [`${__dirname}/subscriber/**/*.{js,ts}`],
        migrations: [`${__dirname}/migration/**/*.{js,ts}`],
        ...config.get('db')
      }),
      inject: [ConfigService]
    }),
    // Static Folder
    // https://docs.nestjs.com/recipes/serve-static

@nestjs/config

Nest - modern, fast, powerful node.js web framework (@config)

MIT
Latest version published 15 days ago

Package Health Score

92 / 100
Full package analysis

Popular @nestjs/config functions

Similar packages