add healthcheck route

This commit is contained in:
lbenedar
2026-04-10 18:34:01 +03:00
parent a465e6a657
commit cd204ebcf5
7 changed files with 94 additions and 20 deletions

21
cmd/api/healthcheck.go Normal file
View File

@@ -0,0 +1,21 @@
package main
import "net/http"
func (app *application) healthcheckHandler(w http.ResponseWriter, r *http.Request) {
env := envelope{
"status": "available",
"system_info": map[string]string{
"environment": app.cfg.env,
"version": version,
},
"foundry": map[string]any{
"status": app.foundryApp.Status,
"is_available": app.foundryApp.IsAvailable,
},
}
err := app.writeJSON(w, http.StatusOK, env, nil)
if err != nil {
app.serverErrorResponse(w, r, err)
}
}