32 lines
678 B
Go
32 lines
678 B
Go
package handlers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
// HealthHandler handles health check endpoint
|
|
type HealthHandler struct{}
|
|
|
|
// NewHealthHandler creates a new health handler
|
|
func NewHealthHandler() *HealthHandler {
|
|
return &HealthHandler{}
|
|
}
|
|
|
|
// Check returns API health status
|
|
func (h *HealthHandler) Check(w http.ResponseWriter, r *http.Request) {
|
|
if r.Method != http.MethodGet {
|
|
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
|
return
|
|
}
|
|
|
|
response := map[string]interface{}{
|
|
"status": "healthy",
|
|
"service": "aggios-api",
|
|
"version": "1.0.0",
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode(response)
|
|
}
|