feat: add global cors
This commit is contained in:
parent
1dd4fa22cd
commit
1f5a3d19e4
2
main.go
2
main.go
|
@ -13,6 +13,7 @@ import (
|
||||||
"github.com/iris-contrib/swagger"
|
"github.com/iris-contrib/swagger"
|
||||||
"github.com/iris-contrib/swagger/swaggerFiles"
|
"github.com/iris-contrib/swagger/swaggerFiles"
|
||||||
"github.com/kataras/iris/v12"
|
"github.com/kataras/iris/v12"
|
||||||
|
"github.com/kataras/iris/v12/middleware/cors"
|
||||||
"github.com/kataras/iris/v12/mvc"
|
"github.com/kataras/iris/v12/mvc"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"log"
|
"log"
|
||||||
|
@ -51,6 +52,7 @@ func main() {
|
||||||
app := iris.New()
|
app := iris.New()
|
||||||
// Enable Gzip compression for responses
|
// Enable Gzip compression for responses
|
||||||
app.Use(iris.Compression)
|
app.Use(iris.Compression)
|
||||||
|
app.UseRouter(cors.New().Handler())
|
||||||
|
|
||||||
// Serve static files from the embedded directory at the app's root path
|
// Serve static files from the embedded directory at the app's root path
|
||||||
app.HandleDir("/", embedFrontend)
|
app.HandleDir("/", embedFrontend)
|
||||||
|
|
Loading…
Reference in New Issue