Add a healthcheck endpoint (#48)

Signed-off-by: Quentin Gliech <quenting@element.io>
This commit is contained in:
Quentin Gliech 2022-01-21 11:37:42 +01:00 committed by GitHub
parent ff28125e8b
commit 35650109cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

1
changelog.d/48.misc Normal file
View file

@ -0,0 +1 @@
Add a /health endpoint that always replies with a 200 OK.

View file

@ -167,6 +167,10 @@ func main() {
} }
http.Handle("/api/listing/", fs) 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.Println("Listening on", *bindAddr)
log.Fatal(http.ListenAndServe(*bindAddr, nil)) log.Fatal(http.ListenAndServe(*bindAddr, nil))