add healthcheck route
This commit is contained in:
21
cmd/api/healthcheck.go
Normal file
21
cmd/api/healthcheck.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user