From bcd61321e6f916a91566fa1404216e80f9c3be9f Mon Sep 17 00:00:00 2001 From: saji Date: Mon, 4 Mar 2024 20:40:55 -0600 Subject: [PATCH] add CORS to api --- http.go | 1 + 1 file changed, 1 insertion(+) diff --git a/http.go b/http.go index 4cec881..112cc66 100644 --- a/http.go +++ b/http.go @@ -80,6 +80,7 @@ func TelemRouter(log *slog.Logger, broker *Broker, db *TelemDb) http.Handler { r.Use(middleware.RealIP) r.Use(middleware.Logger) // TODO: integrate with slog instead of go default logger. r.Use(middleware.Recoverer) + r.Use(middleware.SetHeader("Access-Control-Allow-Origin", "*")) // heartbeat request. r.Get("/ping", func(w http.ResponseWriter, r *http.Request) {