mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-24 08:02:32 +02:00
22 lines
359 B
Go
22 lines
359 B
Go
package server
|
|
|
|
import (
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
)
|
|
|
|
func registerHealthChecker(mux *http.ServeMux) {
|
|
req := &http.Request{
|
|
Method: "GET",
|
|
URL: &url.URL{
|
|
Path: HealthPath,
|
|
},
|
|
}
|
|
if _, path := mux.Handler(req); path != HealthPath {
|
|
mux.HandleFunc(HealthPath, func(w http.ResponseWriter, r *http.Request) {
|
|
io.WriteString(w, "ok")
|
|
})
|
|
}
|
|
}
|