27 lines
549 B
Go
27 lines
549 B
Go
package health
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
type Status struct {
|
|
Status string `json:"status"`
|
|
Service string `json:"service"`
|
|
Timestamp string `json:"timestamp"`
|
|
}
|
|
|
|
func Handler() http.Handler {
|
|
mux := http.NewServeMux()
|
|
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
_ = json.NewEncoder(w).Encode(Status{
|
|
Status: "ok",
|
|
Service: "cmpp-gateway",
|
|
Timestamp: time.Now().UTC().Format(time.RFC3339Nano),
|
|
})
|
|
})
|
|
return mux
|
|
}
|