frontend: add simple /healthz endpoint
Decouple frontend health checks from GET /, which relies on other services to be reachable. See #34. Closes #34. Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
parent
efef44c2d7
commit
0f23d6bbf9
2 changed files with 3 additions and 2 deletions
|
@ -30,7 +30,7 @@ spec:
|
|||
readinessProbe:
|
||||
initialDelaySeconds: 10
|
||||
httpGet:
|
||||
path: "/"
|
||||
path: "/_healthz"
|
||||
port: 8080
|
||||
httpHeaders:
|
||||
- name: "Cookie"
|
||||
|
|
|
@ -121,7 +121,8 @@ func main() {
|
|||
r.HandleFunc("/logout", svc.logoutHandler).Methods(http.MethodGet)
|
||||
r.HandleFunc("/cart/checkout", svc.placeOrderHandler).Methods(http.MethodPost)
|
||||
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
|
||||
r.HandleFunc("/robots.txt", func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "User-agent: *\nDisallow: /") })
|
||||
r.HandleFunc("/robots.txt", func(w http.ResponseWriter, _ *http.Request) { fmt.Fprint(w, "User-agent: *\nDisallow: /") })
|
||||
r.HandleFunc("/_healthz", func(w http.ResponseWriter, _ *http.Request) { fmt.Fprint(w, "ok") })
|
||||
|
||||
var handler http.Handler = r
|
||||
handler = &logHandler{log: log, next: handler} // add logging
|
||||
|
|
Loading…
Reference in a new issue