greenlight/cmd/api/healthcheck.go

23 lines
407 B
Go

package main
import (
"net/http"
)
func (app *application) healthCheckHandler(w http.ResponseWriter, r *http.Request) {
envelopedHealth := envelope{
"status": "available",
"system_info": map[string]string{
"environment": app.config.env,
"version": version,
},
}
err := app.writeJSON(w, http.StatusOK, envelopedHealth, nil)
if err != nil {
app.serverErrorResponse(w, r, err)
}
}