-
Notifications
You must be signed in to change notification settings - Fork 24
Add a /api/health Endpoint for System Monitoring #41
Copy link
Copy link
Open
Labels
backendenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
🌟 [GFI] Add a /api/health Endpoint for System Monitoring
Description
To ensure our backend infrastructure (Node.js API, MongoDB, and Redis) is running smoothly, we need a dedicated Health Check endpoint. This is a standard practice in backend engineering, allowing uptime monitoring services (like UptimeRobot or Datadog) to verify that our system is healthy and connected to its dependencies.
🎯 What needs to be done:
- Navigate to the
backend/routes/directory. - Create a new file (or add to an existing general route file) to handle a
GET /api/healthrequest. - In the controller logic, perform quick connectivity checks:
- Check if the Mongoose connection to MongoDB is ready (
mongoose.connection.readyState === 1). - Check if the Redis client is connected and responsive.
- Check if the Mongoose connection to MongoDB is ready (
- Return a JSON response detailing the status of the API and its dependencies.
📝 Expected JSON Response Format:
{
"status": "ok", // or "error" if dependencies fail
"timestamp": "2026-03-08T12:00:00.000Z",
"dependencies": {
"mongodb": "connected", // or "disconnected"
"redis": "connected" // or "disconnected"
}
}
💡 How to Contribute:
- Comment on this issue to get it assigned to you.
- Fork the repository and create a new branch (e.g., feat/health-endpoint).
- Implement the logic and test it locally using Postman, cURL, or your browser.
- Submit a Pull Request (PR) and mention this issue (e.g., Fixes #ISSUE_NUMBER).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
backendenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers