router.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // @APIVersion 1.0.0
  2. // @Title beego Test API
  3. // @Description beego has a very cool tools to autogenerate documents for your API
  4. // @Contact astaxie@gmail.com
  5. // @TermsOfServiceUrl http://beego.me/
  6. // @License Apache 2.0
  7. // @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
  8. package routers
  9. import (
  10. "github.com/beego/beego/v2/server/web"
  11. "github.com/beego/beego/v2/server/web/filter/cors"
  12. "hongze/hongze_mfyx/controllers"
  13. )
  14. func init() {
  15. web.InsertFilter("*", web.BeforeRouter, cors.Allow(&cors.Options{
  16. AllowAllOrigins: true,
  17. AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
  18. AllowHeaders: []string{"Origin", "Account", "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", "Sign"},
  20. AllowCredentials: true,
  21. }))
  22. ns := web.NewNamespace("/api",
  23. web.NSNamespace("/home",
  24. web.NSInclude(
  25. &controllers.HomeController{},
  26. ),
  27. ),
  28. web.NSNamespace("/wechat",
  29. web.NSInclude(
  30. &controllers.WechatController{},
  31. &controllers.WechatCommonController{},
  32. ),
  33. ),
  34. web.NSNamespace("/user",
  35. web.NSInclude(
  36. &controllers.UserController{},
  37. &controllers.UserCommonController{},
  38. ),
  39. ),
  40. web.NSNamespace("/article",
  41. web.NSInclude(
  42. &controllers.ArticleController{},
  43. &controllers.ArticleControllerMobile{},
  44. ),
  45. ),
  46. web.NSNamespace("/config",
  47. web.NSInclude(
  48. &controllers.ConfigController{},
  49. ),
  50. web.NSInclude(
  51. &controllers.BaseConfigController{},
  52. ),
  53. ),
  54. web.NSNamespace("/search",
  55. web.NSInclude(
  56. &controllers.SearchController{},
  57. ),
  58. ),
  59. web.NSNamespace("/resource",
  60. web.NSInclude(
  61. &controllers.ResourceController{},
  62. ),
  63. ),
  64. web.NSNamespace("/report",
  65. web.NSInclude(
  66. &controllers.ReportController{},
  67. ),
  68. ),
  69. web.NSNamespace("/activity",
  70. web.NSInclude(
  71. &controllers.ActivityCoAntroller{},
  72. &controllers.ActivityABaseController{},
  73. ),
  74. ),
  75. web.NSNamespace("/industry",
  76. web.NSInclude(
  77. &controllers.IndustryController{},
  78. ),
  79. ),
  80. web.NSNamespace("/research",
  81. web.NSInclude(
  82. &controllers.ResearchController{},
  83. ),
  84. ),
  85. web.NSNamespace("/activity_signin",
  86. web.NSInclude(
  87. &controllers.ActivitySignCoAntroller{},
  88. ),
  89. ),
  90. web.NSNamespace("/banner",
  91. web.NSInclude(
  92. &controllers.BannerController{},
  93. ),
  94. ),
  95. web.NSNamespace("/tag",
  96. web.NSInclude(
  97. &controllers.TagController{},
  98. ),
  99. ),
  100. web.NSNamespace("/yanxuan_special",
  101. web.NSInclude(
  102. &controllers.YanxuanSpecialController{},
  103. &controllers.BaseAuthMobileController{},
  104. &controllers.YanxuanSpecialMessageController{},
  105. ),
  106. ),
  107. web.NSNamespace("/advice",
  108. web.NSInclude(
  109. &controllers.AdviceController{},
  110. ),
  111. ),
  112. web.NSNamespace("/micro_roadshow",
  113. web.NSInclude(
  114. &controllers.MicroRoadShowController{},
  115. ),
  116. ),
  117. web.NSNamespace("/order",
  118. web.NSInclude(
  119. &controllers.OrderController{},
  120. ),
  121. ),
  122. )
  123. web.AddNamespace(ns)
  124. }