router.go 1.3KB

1234567891011121314151617181920212223242526
  1. package routers
  2. import (
  3. admin_api "XT_Admin_Api/controllers/admin_api_controllers"
  4. function_api "XT_Admin_Api/controllers/function_api_controllers"
  5. "github.com/astaxie/beego"
  6. "github.com/astaxie/beego/plugins/cors"
  7. )
  8. func init() {
  9. beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
  10. // AllowAllOrigins: true,
  11. AllowOrigins: []string{"https://xt.kuyicloud.com", "http://localhost:9527", "http://xt.test.shengws.com","https://xt.test.shengws.com", "http://xt.test.sgjyun.com","https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com","https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com"},
  12. AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
  13. AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
  14. ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
  15. AllowCredentials: true,
  16. }))
  17. // beego.Router("/", &controllers.MainController{})
  18. admin_api.AdminAPIControllersRegisterRouters()
  19. function_api.FunctionAPIControllersRegisterRouters()
  20. }