package routers import ( admin_api "XT_Admin_Api/controllers/admin_api_controllers" function_api "XT_Admin_Api/controllers/function_api_controllers" "github.com/astaxie/beego" "github.com/astaxie/beego/plugins/cors" ) func init() { beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{ // AllowAllOrigins: true, AllowOrigins: []string{"http://api.szjkhd.com", "http://admin.xt.test.szjkhd.com", "http://admin.xt.szjkhd.com", "http://localhost:9527"}, AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, AllowHeaders: []string{"Origin", "Authorization", "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, })) // beego.Router("/", &controllers.MainController{}) admin_api.AdminAPIControllersRegisterRouters() function_api.FunctionAPIControllersRegisterRouters() }