router.go 956B

12345678910111213141516171819202122232425
  1. package routers
  2. import (
  3. "Data_Upload_Api/controllers"
  4. admin_api "Data_Upload_Api/controllers/admin_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{"http://api.szjkhd.com", "http://admin.xt.test.szjkhd.com", "http://127.0.0.1:9555", "http://localhost:9527"},
  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. controllers.SyncAPIRegisterRouters()
  20. }