feat: add global cors

This commit is contained in:
Derrick Hammer 2023-06-28 01:06:38 -04:00
parent 1dd4fa22cd
commit 1f5a3d19e4
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 0 deletions

View File

@ -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)