From 35650109cc47f2cdc7687f3a94528d5e98f5b0fa Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Fri, 21 Jan 2022 11:37:42 +0100 Subject: [PATCH] Add a healthcheck endpoint (#48) Signed-off-by: Quentin Gliech --- changelog.d/48.misc | 1 + main.go | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 changelog.d/48.misc diff --git a/changelog.d/48.misc b/changelog.d/48.misc new file mode 100644 index 0000000..63b32e7 --- /dev/null +++ b/changelog.d/48.misc @@ -0,0 +1 @@ +Add a /health endpoint that always replies with a 200 OK. diff --git a/main.go b/main.go index 5cce776..dcaeaf8 100644 --- a/main.go +++ b/main.go @@ -167,6 +167,10 @@ func main() { } http.Handle("/api/listing/", fs) + http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, "ok") + }) + log.Println("Listening on", *bindAddr) log.Fatal(http.ListenAndServe(*bindAddr, nil))