Skip to content

feat(api): added health check endpoint#11

Merged
LightJack05 merged 2 commits intomainfrom
health-check
Jan 16, 2026
Merged

feat(api): added health check endpoint#11
LightJack05 merged 2 commits intomainfrom
health-check

Conversation

@LightJack05
Copy link
Contributor

Closes #8

Copilot AI review requested due to automatic review settings January 16, 2026 17:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a health check endpoint to verify the database connection status. The endpoint returns HTTP 200 if the database is reachable and HTTP 503 if it is not.

Changes:

  • Added a new /health endpoint that pings the database
  • Created a HealthController in the internal/health package to handle health checks
  • Integrated the health check endpoint into the router setup

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
main.go Added setupHealthCheckEndpoint function and integrated it into the router
internal/health/controller.go Created HealthController struct with DB client
internal/health/get.go Implemented Get handler that pings the database and returns appropriate status

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return r
}

func setupHealthCheckEndpoint(db *mongo.Client, router *gin.Engine) {
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GET handler registration is incomplete. The second argument (handler function) is missing. This should instantiate a HealthController and pass its Get method as the handler.

Copilot uses AI. Check for mistakes.
Comment on lines 66 to +68

func setupHealthCheckEndpoint(db *mongo.Client, router *gin.Engine) {
hc := &health.HealthController{
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setupHealthCheckEndpoint function should accept the database client as a parameter (similar to setupEndpoints) to pass it to the HealthController, since the health check needs to ping the database.

Copilot uses AI. Check for mistakes.
@LightJack05 LightJack05 merged commit a7fe50b into main Jan 16, 2026
6 checks passed
@LightJack05 LightJack05 deleted the health-check branch January 16, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implement the healthcheck endpoint

1 participant