Debian Codegraph @

vendor/github.com/xiang90/probing/server.go

raw
1 package probing
2
3 import (
4 "encoding/json"
5 "net/http"
6 "time"
7 )
8
9 func NewHandler() http.Handler {
10 return &httpHealth{}
11 }
12
13 type httpHealth struct {
14 }
15
16 type Health struct {
17 OK bool
18 Now time.Time
19 }
20
21 func (h *httpHealth) ServeHTTP(w http.ResponseWriter, r *http.Request) {
22 health := Health{OK: true, Now: time.Now()}
23 e := json.NewEncoder(w)
24 e.Encode(health)
25 }