123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- // @APIVersion 1.0.0
- // @Title beego Test API
- // @Description beego has a very cool tools to autogenerate documents for your API
- // @Contact astaxie@gmail.com
- // @TermsOfServiceUrl http://beego.me/
- // @License Apache 2.0
- // @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
- package routers
- import (
- "github.com/beego/beego/v2/server/web"
- "github.com/beego/beego/v2/server/web/filter/cors"
- "hongze/hongze_api/controllers"
- )
- func init() {
- //解决跨域问题
- web.InsertFilter("*", web.BeforeRouter, cors.Allow(&cors.Options{
- AllowAllOrigins: true,
- AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
- AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
- ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
- AllowCredentials: true,
- }))
- ns := web.NewNamespace("/api",
- web.NSNamespace("/home",
- web.NSInclude(
- &controllers.HomeController{},
- ),
- web.NSInclude(
- &controllers.HomeCommonController{},
- ),
- ),
- web.NSNamespace("/report",
- web.NSInclude(
- &controllers.ReportController{},
- ),
- web.NSInclude(
- &controllers.ReportShareController{},
- ),
- web.NSInclude(
- &controllers.ReportCommonController{},
- ),
- ),
- web.NSNamespace("/classify",
- web.NSInclude(
- &controllers.ClassifyController{},
- ),
- web.NSInclude(
- &controllers.ClassifyCommonController{},
- ),
- ),
- web.NSNamespace("/wechat",
- web.NSInclude(
- &controllers.WechatController{},
- ),
- web.NSInclude(
- &controllers.WechatCommonController{},
- ),
- ),
- web.NSNamespace("/user",
- web.NSInclude(
- &controllers.UserController{},
- ),
- web.NSInclude(
- &controllers.UserCommonController{},
- ),
- web.NSInclude(
- &controllers.UserNotAuthController{},
- ),
- web.NSInclude(
- &controllers.UserPcNotAuthController{},
- ),
- web.NSInclude(
- &controllers.YbApplyController{},
- ),
- ),
- web.NSNamespace("/video",
- web.NSInclude(
- &controllers.VideoController{},
- ),
- ),
- web.NSNamespace("/bill",
- web.NSInclude(
- &controllers.BillController{},
- ),
- ),
- web.NSNamespace("/runlog",
- web.NSInclude(
- &controllers.RunLogController{},
- ),
- ),
- web.NSNamespace("/english_report",
- web.NSInclude(
- &controllers.EnglishReportShareController{},
- &controllers.EnglishReportController{},
- ),
- ),
- )
- web.AddNamespace(ns)
- }
|