From 1f5a3d19e44f1db2f8587623e868fa48b23d1a74 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 28 Jun 2023 01:06:38 -0400 Subject: [PATCH] feat: add global cors --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index 6ca5dc7..cb4649f 100644 --- a/main.go +++ b/main.go @@ -13,6 +13,7 @@ import ( "github.com/iris-contrib/swagger" "github.com/iris-contrib/swagger/swaggerFiles" "github.com/kataras/iris/v12" + "github.com/kataras/iris/v12/middleware/cors" "github.com/kataras/iris/v12/mvc" "go.uber.org/zap" "log" @@ -51,6 +52,7 @@ func main() { app := iris.New() // Enable Gzip compression for responses app.Use(iris.Compression) + app.UseRouter(cors.New().Handler()) // Serve static files from the embedded directory at the app's root path app.HandleDir("/", embedFrontend)