@godal-inc/grpc-health-check-nestjs
v0.1.1
Published
## Installation
Downloads
78
Readme
GRPC Health Check for NestJS
Installation
yarn add @godal-inc/grpc-health-check
Usage
Initial grpc health check
// main.ts
async function bootstrap() {
app = moduleFixture.
createNestMicroservice<MicroserviceOptions>(
AppModule,
extendedHealthCheckGrpcOptions({
options: {
url: '0.0.0.0:5000',
package: ['stores'],
protoPath: ['stores.proto'],
}
})
);
await app.listenAsync()
}
Import health module
@Module({
imports: [
HealthModule // Can custom module
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
Custom Health Check
@Controller()
export class HealthController {
constructor() {}
@GrpcMethod('Health') // decolate with this decolator
check(args: HealthCheckRequest): HealthCheckResponse { // custom this fuction
return {
status: ServingStatus.SERVING
}
}
}