blob: 61d5185331cbd24ba67afe0c2b19d79618dd264e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package api
import (
"encoding/json"
"net/http"
)
type HealthResponse struct {
Status string `json:"status"`
}
func (s *Server) handleHealth(
w http.ResponseWriter,
r *http.Request,
) {
w.Header().Set("Content-Type", "application/json")
response := HealthResponse{
Status: "ok",
}
if err := json.NewEncoder(w).Encode(response); err != nil {
http.Error(
w,
http.StatusText(http.StatusInternalServerError),
http.StatusInternalServerError,
)
}
}
|