-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatus.go
34 lines (26 loc) · 738 Bytes
/
status.go
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
30
31
32
33
34
package main
import (
"encoding/json"
"net/http"
)
type statusResponse struct {
Status string `json:"status"`
}
// AliveHandler is the handler for the /status/alive check
func AliveHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
status := statusResponse{
Status: "Namer service is alive",
}
json.NewEncoder(w).Encode(status)
}
// HealthyHandler is the handler for the /status/heathy check
func HealthyHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
status := statusResponse{
Status: "Namer service is healthy",
}
json.NewEncoder(w).Encode(status)
}