scrm-go

router.go 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  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/mpwechat"
  10. "SCRM/controllers/role"
  11. "github.com/astaxie/beego"
  12. "github.com/astaxie/beego/plugins/cors"
  13. )
  14. func init() {
  15. beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
  16. AllowOrigins: []string{"http://jk.kuyicloud.com", "http://localhost:8090", "http://test1.sgjyun.com", "https://www.ucpaas.com"},
  17. AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
  18. AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
  19. ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
  20. AllowCredentials: true,
  21. }))
  22. global.RegisterRouters()
  23. admin_user.RegisterRouters()
  24. login.RegisterRouters()
  25. role.RegisterRouters()
  26. members.RegisterRouters()
  27. marketing_tool.RegisterRouters()
  28. article.RegisterRouters()
  29. mpwechat.RegisterRouters()
  30. }