Health Check Endpoints Setup for Web Application

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1 servicesAll 2065 services
Health Check Endpoints Setup for Web Application
Simple
~1 business day
FAQ
Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Health Check Endpoints Setup

Health check endpoints verify application health. Load balancers, Kubernetes, monitoring systems query them to exclude unhealthy instances from rotation.

Two check types

Liveness — is the process alive. If not, container restarts. Should respond even with degraded dependencies.

Readiness — is it ready to accept traffic. If not, balancer doesn't route requests. Checks DB, cache, external services.

Laravel: health check endpoints

// routes/api.php
Route::get('/health/live', fn() => response()->json(['status' => 'ok']));

Route::get('/health/ready', function () {
    $checks = [];

    // Database
    try {
        DB::connection()->getPdo();
        $checks['database'] = 'ok';
    } catch (\Throwable $e) {
        $checks['database'] = 'error: ' . $e->getMessage();
    }

    // Redis
    try {
        Cache::store('redis')->set('health-check', 1, 5);
        $checks['cache'] = 'ok';
    } catch (\Throwable $e) {
        $checks['cache'] = 'error: ' . $e->getMessage();
    }

    $healthy = !str_contains(implode('', $checks), 'error');
    $status  = $healthy ? 200 : 503;

    return response()->json([
        'status' => $healthy ? 'healthy' : 'unhealthy',
        'checks' => $checks,
    ], $status);
});

Node.js Express

app.get('/health/live', (_req, res) => {
  res.json({ status: 'ok', uptime: process.uptime() });
});

app.get('/health/ready', async (_req, res) => {
  const checks: Record<string, string> = {};

  try {
    await db.query('SELECT 1');
    checks.database = 'ok';
  } catch (e) {
    checks.database = `error: ${e}`;
  }

  try {
    await redis.ping();
    checks.redis = 'ok';
  } catch (e) {
    checks.redis = `error: ${e}`;
  }

  const healthy = Object.values(checks).every(v => v === 'ok');
  res.status(healthy ? 200 : 503).json({ status: healthy ? 'healthy' : 'unhealthy', checks });
});

Kubernetes probes

containers:
  - name: app
    livenessProbe:
      httpGet:
        path: /health/live
        port: 8080
      initialDelaySeconds: 30
      periodSeconds: 10
      failureThreshold: 3

    readinessProbe:
      httpGet:
        path: /health/ready
        port: 8080
      initialDelaySeconds: 10
      periodSeconds: 5
      failureThreshold: 3

Implementation timeline

Basic liveness + readiness endpoints with DB and Redis checks: 0.5–1 day. With Kubernetes and monitoring system integration: 1–2 days.