Documentation
    Preparing search index...

    Class BaseCheckAbstract

    BaseCheck with shared affordances to define a custom health check

    class CustomCheck extends BaseCheck {
    name = 'Custom check'

    async run() {
    // Your health check logic
    return Result.ok('Everything is working fine')
    }
    }

    const check = new CustomCheck()
    .as('My custom health check')
    .cacheFor('30s')

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    name: string

    A unique name for the health check

    cacheDuration?: number

    The cache duration for the check result in seconds

    Methods

    • Define a custom unique name for the check

      Parameters

      • name: string

        The unique name for the health check

      Returns this

      const check = new MyCheck().as('Database connection check')
      
    • Specify the duration for which the check should be cached for

      Parameters

      • duration: string | number

        The cache duration as a string (e.g., '5s', '1m') or number in seconds

      Returns BaseCheck

      const check = new MyCheck().cacheFor('5 minutes')
      // or
      const check2 = new MyCheck().cacheFor(300) // 300 seconds