Skip to content

[FEATURE] Add /health endpoint with uptime, version, and DB status #87

@Sainava

Description

@Sainava

Description
Add a lightweight health check endpoint to the backend to support liveness/readiness probes and quick diagnostics.

Motivation
Easier local debugging and monitoring
Useful for deployment health checks and CI smoke tests
Visibility into DB connectivity without hitting app routes

Describe the solution you'd like
New route: GET /health
Response: 200 OK with JSON
Fields:
status: "ok"
uptime: number (seconds)
version: string (from server/package.json)
time: ISO timestamp
db: "connected" | "disconnected" (from mongoose.connection.readyState)

Acceptance criteria
GET /health returns 200 with all fields above
Returns db: "disconnected" when Mongo isn’t reachable, but still 200 (service is up even if DB isn’t)
No auth required; route mounted once app starts
Brief tests or curl steps included in PR description

Testing notes
With Mongo running: db === "connected"
Stop Mongo: db === "disconnected"
Verify JSON schema and types

Additional context
This will be an offcial contribution for OSCI'25

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions