How to use the @nestjs/terminus.HealthCheck function in @nestjs/terminus

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 autoai-org / AID / components / discovery / src / systems / systems.controller.ts View on Github external
private readonly dns: DNSHealthIndicator,
        private readonly mongo: MongooseHealthIndicator,
    ) {

    }

    @Get('stats')
    async fetchStats(): Promise {
        return {
            'user_count': await this.userService.count(),
            'model_count': await this.modelService.count()
        }
    }
    
    @Get('health')
    @HealthCheck()
    check() {
        return this.health.check([
            () => this.dns.pingCheck('aid-docs', 'https://aid.autoai.org')
            //() => this.mongo.pingCheck('aid-database', { connection: config.MONGO_URI })
        ]);
    }
}

@nestjs/terminus

Terminus integration provides readiness/liveness health checks for NestJS.

MIT
Latest version published 10 months ago

Package Health Score

81 / 100
Full package analysis

Similar packages