How to use the @golevelup/nestjs-modules.createConfigurableDynamicRootModule function in @golevelup/nestjs-modules

To help you get started, we’ve selected a few @golevelup/nestjs-modules 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 golevelup / nestjs / packages / rabbitmq / src / rabbitmq.module.ts View on Github external
import { ExternalContextCreator } from '@nestjs/core/helpers/external-context-creator';
import { groupBy } from 'lodash';
import { AmqpConnection } from './amqp/connection';
import { RABBIT_CONFIG_TOKEN, RABBIT_HANDLER } from './rabbitmq.constants';
import { RabbitHandlerConfig, RabbitMQConfig } from './rabbitmq.interfaces';

declare var placeholder: IConfigurableDynamicRootModule<
  RabbitMQModule,
  RabbitMQConfig
>;

@Module({
  imports: [DiscoveryModule]
})
export class RabbitMQModule
  extends createConfigurableDynamicRootModule(
    RABBIT_CONFIG_TOKEN,
    {
      providers: [
        {
          provide: AmqpConnection,
          useFactory: async (
            config: RabbitMQConfig
          ): Promise => {
            const connection = new AmqpConnection(config);
            await connection.init();
            const logger = new Logger(RabbitMQModule.name);
            logger.log('Successfully connected to RabbitMQ');
            return connection;
          },
          inject: [RABBIT_CONFIG_TOKEN]
        }
github jmcdo29 / zeldaPlay / apps / api / src / app / config / config.module.ts View on Github external
import { createConfigurableDynamicRootModule } from '@golevelup/nestjs-modules';
import { Module } from '@nestjs/common';
import { CONFIG_MODULE_OPTIONS } from './config.constants';
import { ConfigService } from './config.service';
import { ConfigModuleOptions } from './interfaces/config-options.interface';

@Module({
  providers: [ConfigService],
  exports: [ConfigService],
})
export class ConfigModule extends createConfigurableDynamicRootModule<
  ConfigModule,
  ConfigModuleOptions
>(CONFIG_MODULE_OPTIONS) {
  static Deferred = ConfigModule.externallyConfigured(ConfigModule, 0);
}
github jmcdo29 / zeldaPlay / apps / api / src / app / database / database-core.module.ts View on Github external
import { createConfigurableDynamicRootModule } from '@golevelup/nestjs-modules';
import { Module } from '@nestjs/common';
import { DATABASE_MODULE_OPTIONS } from './database.constants';
import { DatabaseModuleOptions } from './interfaces/database-options.interface';

@Module({
  exports: [DATABASE_MODULE_OPTIONS],
})
export class DatabaseCoreModule extends createConfigurableDynamicRootModule<
  DatabaseCoreModule,
  DatabaseModuleOptions
>(DATABASE_MODULE_OPTIONS) {
  static Deferred = DatabaseCoreModule.externallyConfigured(
    DatabaseCoreModule,
    500,
  );
}

@golevelup/nestjs-modules

Reusable utilties to help level up NestJS Modules

MIT
Latest version published 9 months ago

Package Health Score

88 / 100
Full package analysis

Popular @golevelup/nestjs-modules functions