Health check endpoints
📖 Scenario: You are building a simple web server using Express.js. You want to add endpoints that let users check if the server is running and healthy.
🎯 Goal: Create two health check endpoints: /health that returns a simple status message, and /ready that returns a readiness message.
📋 What You'll Learn
Create an Express app instance called
appAdd a GET endpoint
/health that responds with JSON { status: 'ok' }Add a GET endpoint
/ready that responds with JSON { ready: true }Make the app listen on port
3000💡 Why This Matters
🌍 Real World
Health check endpoints help monitoring systems know if your server is running and ready to handle requests.
💼 Career
Many backend jobs require setting up health checks for services to ensure reliability and uptime.
Progress0 / 4 steps