How to use @nestjs/terminus - 10 common examples

To help you get started, we’ve selected a few @nestjs/terminus 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 danielwii / asuna-node-server / src / dev.ts View on Github external
LoggerFactory,
  MQHealthIndicator,
  RedisHealthIndicator,
  TerminusOptionsService,
  WSModule,
} from '.';

const logger = LoggerFactory.getLogger('ApplicationModule');

@Module({
  imports: [
    TypeOrmModule.forRoot(),
    AdminInternalModule,
    GraphqlModule.forRoot(__dirname),
    WSModule,
    TerminusModule.forRootAsync({
      useClass: TerminusOptionsService.withHealthIndicators(
        async () => new RedisHealthIndicator().isHealthy('redis'),
        async () => new MQHealthIndicator().isHealthy('mq'),
      ),
    }),
  ],
  controllers: [],
})
export class ApplicationModule implements OnModuleInit {
  public onModuleInit(): void {
    logger.log('init...');
  }
}

const pkg = require('../package.json');
github nest-cloud / nestcloud-consul-starter / src / app.module.ts View on Github external
import * as services from './services';
import * as clients from './clients';
import { LoggerModule } from '@nestcloud/logger';

@Module({
  imports: [
    LoggerModule.register(),
    ScheduleModule.register(),
    BootModule.register(__dirname, `bootstrap-${process.env.NODE_ENV || 'development'}.yml`),
    ConsulModule.register({ dependencies: [NEST_BOOT] }),
    ConfigModule.register({ dependencies: [NEST_BOOT, NEST_CONSUL] }),
    ServiceModule.register({ dependencies: [NEST_BOOT, NEST_CONSUL] }),
    LoadbalanceModule.register({ dependencies: [NEST_BOOT] }),
    FeignModule.register({ dependencies: [NEST_LOADBALANCE] }),
    ProxyModule.register({ dependencies: [NEST_BOOT] }),
    TerminusModule.forRootAsync({
      inject: [TypeOrmHealthIndicator],
      useFactory: () => ({ endpoints: [{ url: '/health', healthIndicators: [] }] }),
    }),
  ],
  controllers: components(controllers),
  providers: components(services, clients),
})
export class AppModule {
}
github new-eden-social / new-eden-social / src / api / src / modules / health / health.module.ts View on Github external
import { Module } from '@nestjs/common';
import { TerminusModule } from '@nestjs/terminus';
import { TerminusOptionsService } from './terminus-options.service';

@Module({
  imports: [
    TerminusModule.forRootAsync({
      useClass: TerminusOptionsService,
    }),
  ],
})
export class HealthModule {}
github nestjs / terminus / sample / 002-microservice-app / src / health.module.ts View on Github external
}),
        async () =>
          microservice.pingCheck('redis', {
            transport: Transport.REDIS,
            options: {
              url: 'redis://localhost:6379',
            },
          }),
      ],
    },
  ],
});

@Module({
  imports: [
    TerminusModule.forRootAsync({
      inject: [MicroserviceHealthIndicator],
      useFactory: getTerminusOptions,
    }),
  ],
})
export class HealthModule {}
github juicycleff / ultimate-backend / apps / service-payment / src / app.module.ts View on Github external
buildSchemaOptions: {
        orphanedTypes: [Plan],
      },
      playground: {
        workspaceName: 'GRAPHQL SERVICE PLAN',
        settings: {
          'editor.theme': 'light',
        },
      },
      context: ({ req, res }) => buildContext({ req, res }),
    }),
    CoreModule,
    StripeModule.forRoot({
      apiKey: AppConfig.payment?.stripe?.secretKey,
    }),
    TerminusModule.forRootAsync({
      imports: [AppModule],
      useClass: HealthOptionsService,
    }),
    BillingModule,
    PlanModule,
    CardModule,
    InvoiceModule,
    SubscriptionModule,
  ],
  controllers: [AppController],
  providers: [
    AppService,
    MongoHealthIndicator,
  ],
  exports: [MongoHealthIndicator],
})
github oracle-quickstart / oci-cloudnative / src / user / src / middleware / health / health.module.ts View on Github external
import { OracleDbHealthIndicator } from '../../db/database.health';

const getTerminusOptions = (db: OracleDbHealthIndicator ): TerminusModuleOptions => ({
  endpoints: [
    {
      url: '/health',
      healthIndicators: [
        async () => db.pingCheck('database', { timeout: 1e3 }),
      ],
    },
  ],
});

@Module({
  imports: [
    TerminusModule.forRootAsync({
      imports: [DatabaseModule],
      inject: [OracleDbHealthIndicator],
      useFactory: db => getTerminusOptions(db),
    }),
  ],
})
export class HealthModule { }
github nest-cloud / nestcloud / samples / proxy / 02-dynamic-routes / app.module.ts View on Github external
import { ConsulConfigModule } from '@nestcloud/consul-config';
import { ConsulServiceModule } from '@nestcloud/consul-service';
import { NEST_BOOT, NEST_CONSUL_CONFIG } from '@nestcloud/common';
import { TerminusModule } from '@nestjs/terminus';
import { GatewayModule } from '@nestcloud/gateway';
import { ApiController } from "./api.controller";
import { GatewayService } from "./gateway.service";

@Module({
    imports: [
        BootModule.register(__dirname, `config.yaml`),
        ConsulModule.register({ dependencies: [NEST_BOOT] }),
        ConsulConfigModule.register({ dependencies: [NEST_BOOT] }),
        ConsulServiceModule.register({ dependencies: [NEST_BOOT] }),
        GatewayModule.register({ dependencies: [NEST_CONSUL_CONFIG] }),
        TerminusModule.forRootAsync({
            useFactory: () => ({ endpoints: [{ url: '/health', healthIndicators: [] }] }),
        }),
    ],
    controllers: [ApiController],
    providers: [GatewayService]
})
export class AppModule {
}
github jmcdo29 / zeldaPlay / apps / api / src / app / app.module.ts View on Github external
import { SpellModule } from './spell/spell.module';

@Module({
  imports: [
    ConfigModule.forRootAsync(ConfigModule, {
      useClass: ConfigModuleConfig,
    }),
    DatabaseModule.forRootAsync({
      imports: [ConfigModule.Deferred],
      useClass: DatabaseModuleConfig,
    }),
    GraphQLModule.forRootAsync({
      imports: [ConfigModule.Deferred],
      useClass: GraphQLModuleConfig,
    }),
    TerminusModule.forRootAsync({
      useClass: TerminusOptionsService,
    }),
    OgmaModule.forRootAsync({
      useClass: OgmaModuleConfig,
      imports: [ConfigModule.Deferred],
    }),
    AuthModule,
    CharacterModule,
    AbilityScoreModule,
    SpellModule,
  ],
  providers: [AppService, AppResolver],
})
export class AppModule {}
github nest-cloud / nestcloud / samples / proxy / 01-forward-request / app.module.ts View on Github external
import { Module } from '@nestjs/common';
import { BootModule } from '@nestcloud/boot';
import { ConsulModule } from '@nestcloud/consul';
import { ConsulServiceModule } from '@nestcloud/consul-service';
import { NEST_BOOT } from '@nestcloud/common';
import { TerminusModule } from '@nestjs/terminus';
import { GatewayModule } from '@nestcloud/gateway';
import { ApiController } from "./api.controller";

@Module({
    imports: [
        BootModule.register(__dirname, `config.yaml`),
        ConsulModule.register({ dependencies: [NEST_BOOT] }),
        ConsulServiceModule.register({ dependencies: [NEST_BOOT] }),
        GatewayModule.register({ dependencies: [NEST_BOOT] }),
        TerminusModule.forRootAsync({
            useFactory: () => ({ endpoints: [{ url: '/health', healthIndicators: [] }] }),
        }),
    ],
    controllers: [ApiController]
})
export class AppModule {
}
github nestjs / terminus / sample / 003-memory-app / src / health / health.module.ts View on Github external
import { Module } from '@nestjs/common';
import { TerminusModule } from '@nestjs/terminus';

import { TerminusOptionsService } from './terminus-options.service';

@Module({
  imports: [
    TerminusModule.forRootAsync({
      useClass: TerminusOptionsService,
    }),
  ],
})
export class HealthModule {}

@nestjs/terminus

Terminus integration provides readiness/liveness health checks for NestJS.

MIT
Latest version published 9 months ago

Package Health Score

81 / 100
Full package analysis

Similar packages