Initial commit

This commit is contained in:
2025-11-29 16:59:02 -06:00
commit da4f051282
25 changed files with 1144 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
package handlers
import (
"database/sql"
"net/http"
)
type HealthResponse struct {
Status string `json:"status"`
DBConnected bool `json:"db_connected"`
}
type HealthcheckService struct {
db *sql.DB
}
func NewHealthcheckService(db *sql.DB) *HealthcheckService {
return &HealthcheckService{db: db}
}
func (h *HealthcheckService) Health(w http.ResponseWriter, r *http.Request) {
response := HealthResponse{
Status: "ok",
}
err := h.db.Ping()
response.DBConnected = err == nil
JSON(w, http.StatusOK, response)
}