blob: 814fef5159a6dd4692e8dce0d48a60620257a415 (
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
|
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 {
writeError(w, http.StatusInternalServerError, "failed to encode response")
}
}
|