Files
go-playground/projects/greenlight/cmd/api/healthcheck.go
T
2026-03-11 15:50:38 +01:00

20 lines
390 B
Go

package main
import (
"net/http"
)
func (app *application) healthcheckHandler(w http.ResponseWriter, r *http.Request) {
env := envelope{
"status": "available",
"environment": app.config.env,
"version": version,
}
err := app.writeJSON(w, http.StatusOK, env, nil)
if err != nil {
// Use the new serverErrorResponse() helper.
app.serverErrorResponse(w, r, err)
}
}