diff --git a/main.go b/main.go index 0d28d9f..1480e3f 100644 --- a/main.go +++ b/main.go @@ -16,16 +16,23 @@ import ( "git.cliffbreak.de/Cliffbreak/tsviewer/service" "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" + "github.com/go-chi/cors" ) func Routes(s service.Service, t template.Template) *chi.Mux { router := chi.NewRouter() + cors := cors.New(cors.Options{ + AllowedOrigins: []string{"*"}, + AllowedMethods: []string{"Get"}, + }) router.Use( middleware.Logger, middleware.Timeout(5*time.Second), middleware.DefaultCompress, middleware.RedirectSlashes, middleware.Recoverer, + + cors.Handler, ) router.Route("/v1", func(r chi.Router) {