File

lib/health-indicators/health-indicator.ts

Description

Represents an abstract health indicator with common functionalities

A custom HealthIndicator should inherit the HealthIndicator class.

```typescript *

  • class MyHealthIndicator extends HealthIndicator {
  • public check(key: string) {
  • // Replace with the actual check
  • const isHealthy = true;
  • // Returns { [key]: { status: 'up', message: 'Up and running' } }
  • return super.getStatus(key, isHealthy, { message: 'Up and running' });
  • }
  • }
  • ```

Example

Index

Methods

Methods

Protected getStatus
getStatus(key: string, isHealthy: boolean, data?: literal type)

Generates the health indicator result object

Parameters :
Name Type Optional Description
key string No

The key which will be used as key for the result object

isHealthy boolean No

Whether the health indicator is healthy

data literal type Yes

Additional data which will get appended to the result object

result-matching ""

    No results matching ""