Add health endpoint

Hosting this behind an ALB/ELB requires a health check route.
This commit is contained in:
patwie
2024-05-14 15:12:42 +00:00
parent eea09906f4
commit 0e8c968aa3
+6 -1
View File
@@ -132,7 +132,6 @@ func setupSocketIO() *socketio.Server {
Origin: "*",
Credentials: true,
})
opts.SetTransports(types.NewSet("polling", "webtransport"))
ioo := socketio.NewServer(nil, opts)
ioo.On("connection", func(clients ...any) {
@@ -243,6 +242,12 @@ func main() {
r := setupRouter(documentStore)
ioo := setupSocketIO()
r.Handle("/socket.io/", ioo.ServeHandler(nil))
r.Get("/ping", func(w http.ResponseWriter, _ *http.Request) {
_, err := w.Write([]byte("pong"))
if err != nil {
panic(err)
}
})
r.Mount("/", handleUI())
go http.ListenAndServe(":3002", r)