1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- // @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.AddNamespace(ns)
- }
|