|
@@ -10,9 +10,18 @@ package routers
|
|
|
import (
|
|
|
"eta/eta_hub/controllers"
|
|
|
"github.com/beego/beego/v2/server/web"
|
|
|
+ "github.com/beego/beego/v2/server/web/filter/cors"
|
|
|
)
|
|
|
|
|
|
func init() {
|
|
|
+
|
|
|
+ web.InsertFilter("*", web.BeforeRouter, cors.Allow(&cors.Options{
|
|
|
+ AllowAllOrigins: true,
|
|
|
+ AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
|
|
+ AllowHeaders: []string{"Origin", "Authorization", "Uuid", "Accesstoken", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
|
|
|
+ ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
|
|
|
+ AllowCredentials: true,
|
|
|
+ }))
|
|
|
var ns = web.NewNamespace("/v1",
|
|
|
web.NSNamespace("/report",
|
|
|
web.NSInclude(
|