Files
greenlight/cmd/api/healthcheck.go
lbenedar 1d7beb7de4 ch3.4
2026-03-10 15:39:45 +03:00

21 lines
486 B
Go

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.config.env,
"version": version,
},
}
err := app.writeJSON(w, http.StatusOK, env, nil)
if err != nil {
app.logger.Print(err)
http.Error(w, "The server encountered a problem and could not process your request", http.StatusInternalServerError)
}
}