Add Backend Health Check Endpoint#110
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a standard health check endpoint at
/healthfor the go-towerfall backend server, enabling better monitoring, orchestration, and operational visibility.Closes: #108
Changes
New Endpoint:
GET /healthAdded a new health check endpoint that returns a simple JSON response indicating server health status:
{ "status": "ok", "timestamp": "2026-01-25T20:22:28Z" }Implementation Details
Response Type (http_types.go:75-79)
HealthCheckResponsestruct withstatusandtimestampfieldsRequest Handler (http_handlers.go:999-1028)
HandleHealthhandler following existing backend patternsRoute Registration (main.go:16)
/healthroute in main server initializationDesign Decisions
Path Choice:
/health(industry standard) instead of/api/healthNo Authentication: Health checks are publicly accessible for monitoring tools
Simple Response: Returns minimal data (status + timestamp) for fast responses
CORS-Enabled: Supports cross-origin requests with proper headers
Testing
Verified the endpoint works correctly:
✓
GET /healthreturns 200 OK with valid JSON response✓
OPTIONS /healthreturns 200 OK with CORS headers (preflight support)✓
POST /healthreturns 405 Method Not Allowed with error message✓ Backend builds successfully without errors
Use Cases
This endpoint enables: