Add a healthcheck endpoint (#48)
Signed-off-by: Quentin Gliech <quenting@element.io>
This commit is contained in:
parent
ff28125e8b
commit
35650109cc
2 changed files with 5 additions and 0 deletions
1
changelog.d/48.misc
Normal file
1
changelog.d/48.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Add a /health endpoint that always replies with a 200 OK.
|
4
main.go
4
main.go
|
@ -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))
|
||||||
|
|
Reference in a new issue