scrm-go

router.go 1.0KB

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