26 lines
540 B
Go
26 lines
540 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
// HealthCheck godoc
|
|
//
|
|
// @Summary Health Check
|
|
// @Description Health Check
|
|
// @Tags ops
|
|
// @Success 204 {string} string "ok"
|
|
// @Failure 500 {object} error "Internal Server Error"
|
|
// @Router /health [get]
|
|
func (api *api) healthCheckHandler(w http.ResponseWriter, r *http.Request) {
|
|
data := map[string]string{
|
|
"status": "ok",
|
|
"env": api.config.env,
|
|
"version": version,
|
|
}
|
|
|
|
if err := api.jsonResponse(w, http.StatusOK, data); err != nil {
|
|
api.internalServerError(w, r, err)
|
|
}
|
|
}
|