WayrApp Backend & Ecosystem Documentation - v1.0.0
    Preparing search index...
    • Performs comprehensive system health check across all components.

      Aggregates health status from database, cache, and memory checks to provide an overall system health assessment. Returns detailed component status and determines overall system health based on individual component states. Ideal for Kubernetes readiness probes and monitoring dashboards.

      Returns Promise<
          {
              status: string;
              components: {
                  database: | {
                      status: string;
                      latency: number;
                      timestamp: string;
                      error?: undefined;
                  }
                  | {
                      latency?: undefined;
                      status: string;
                      error: string;
                      timestamp: string;
                  };
                  cache: { status: string; stats: CacheStats; timestamp: string };
                  memory: {
                      status: string;
                      usage: { heapUsedMB: number; heapTotalMB: number; externalMB: number };
                      timestamp: string;
                  };
              };
              uptime: number;
              timestamp: string;
          },
      >

      Comprehensive system health status

      const systemHealth = await healthChecks.system();
      console.log(`System status: ${systemHealth.status}`);
      console.log(`Uptime: ${systemHealth.uptime} seconds`);
      console.log('Component status:', systemHealth.components);
      // Use for Kubernetes readiness probe
      app.get('/ready', async (req, res) => {
      const health = await healthChecks.system();
      const statusCode = health.status === 'healthy' ? 200 : 503;
      res.status(statusCode).json(health);
      });