Pick your framework, toggle dependency checks, and get a production-ready/healthendpoint with liveness and readiness probes.
// Health Check Endpoint // Generated by TurboDeploy // Endpoint: /health 400">const express = 400">require(300">'express'); 400">const app = express(); app.get(300">'/health', 400">async (req, res) => { 400">let status = 200; 400">const results = {}; results.uptime = process.uptime(); results.version = 300">'1.0.0'; results.timestamp = new Date().toISOString(); // Database check 400">try { 400">const pool = 400">require(300">'./db'); // your db pool 400">await pool.query(300">'SELECT 1'); results.database = { status: 300">'ok', 400">type: 300">'postgresql' }; } 400">catch (err) { results.database = { status: 300">'error', 400">type: 300">'postgresql' }; status = 503; } // Redis check 400">try { 400">const redis = 400">require(300">'./redis'); // your redis client 400">await redis.ping(); results.redis = { status: 300">'ok' }; } 400">catch (err) { results.redis = { status: 300">'error' }; status = 503; } // Memory check 400">const mem = process.memoryUsage(); results.memory = { heapUsedMB: Math.round(mem.heapUsed / 1024 / 1024), heapTotalMB: Math.round(mem.heapTotal / 1024 / 1024), rssMB: Math.round(mem.rss / 1024 / 1024), }; res.status(status).json({ status: status === 200 ? 300">'healthy' : 300">'unhealthy', ...results, }); }); // Liveness probe (lightweight) app.get(300">'/health/live', (req, res) => { res.status(200).json({ status: 300">'alive' }); }); // Readiness probe app.get(300">'/health/ready', 400">async (req, res) => { 400">try { 400">const pool = 400">require(300">'./db'); 400">await pool.query(300">'SELECT 1'); res.status(200).json({ status: 300">'ready' }); } 400">catch { res.status(503).json({ status: 300">'not ready' }); } });
TurboDeploy auto-configures liveness and readiness probes for your infrastructure.