scrm-go

router.go 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. package routers
  2. import (
  3. "SCRM/controllers/admin_user"
  4. "SCRM/controllers/article"
  5. "SCRM/controllers/global"
  6. "SCRM/controllers/login"
  7. "SCRM/controllers/marketing_tool"
  8. "SCRM/controllers/members"
  9. "SCRM/controllers/role"
  10. "github.com/astaxie/beego"
  11. "github.com/astaxie/beego/plugins/cors"
  12. )
  13. func init() {
  14. beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
  15. AllowOrigins: []string{"http://jk.kuyicloud.com", "http://localhost:8090", "http://test1.sgjyun.com", "https://www.ucpaas.com"},
  16. AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
  17. AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
  18. ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
  19. AllowCredentials: true,
  20. }))
  21. global.RegisterRouters()
  22. admin_user.RegisterRouters()
  23. login.RegisterRouters()
  24. role.RegisterRouters()
  25. members.RegisterRouters()
  26. marketing_tool.RegisterRouters()
  27. article.RegisterRouters()
  28. }