Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Pragyat-Nikunj/Learning-Management-System-backend/llms.txt

Use this file to discover all available pages before exploring further.

The health check endpoint gives you a single, unauthenticated call to confirm that the API server is reachable and that the underlying MongoDB database is connected. It is the first endpoint to call when troubleshooting connectivity or integrating an uptime monitor. The response HTTP status reflects the overall health — 200 when both the server and database are healthy, 503 when the database is unreachable, and 500 for unexpected internal errors.

Endpoint

method
string
GET
GET /api/v1/healthcheck
Auth required: No — this endpoint is public.

Request

No request body, query parameters, or headers are required.
curl --request GET \
  --url http://localhost:4000/api/v1/healthcheck

Response

200 — Healthy

Returned when the server is running and the database connection is in the connected ready-state.
status
string
required
Overall system status. Value is "OK" when healthy.
timeStamp
string
required
ISO 8601 timestamp of when the check was performed.
services
object
required
Container for individual service statuses.
Example 200 response
{
  "status": "OK",
  "timeStamp": "2024-11-15T10:22:04.321Z",
  "services": {
    "databases": {
      "status": "healthy",
      "details": {
        "isConnected": true,
        "readyState": "connected"
      }
    },
    "server": {
      "status": "healthy",
      "uptime": 3842.17,
      "memoryUsage": {
        "rss": 62423040,
        "heapTotal": 29933568,
        "heapUsed": 23411952,
        "external": 2084281,
        "arrayBuffers": 43082
      }
    }
  }
}

503 — Database unhealthy

Returned when MongoDB is unreachable or in a non-connected state. The response body has the same shape as the 200 response, but services.databases.status is "unhealthy" and services.databases.details.readyState reflects the actual Mongoose ready-state code.

500 — Internal error

Returned when the health check itself throws an unexpected exception.
status
string
Value is "ERROR".
timeStamp
string
ISO 8601 timestamp of when the error occurred.
error
string
The error message from the thrown exception.

Use this endpoint in your container orchestration health probes (Kubernetes livenessProbe / readinessProbe) or uptime monitoring services. A 200 response means the system is ready to accept traffic.

Build docs developers (and LLMs) love