123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- // @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 (
- "eta/eta_mini_bridge/controllers"
- "github.com/beego/beego/v2/server/web"
- "github.com/beego/beego/v2/server/web/filter/cors"
- )
- func init() {
- web.InsertFilter("*", web.BeforeRouter, cors.Allow(&cors.Options{
- AllowAllOrigins: true,
- AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
- AllowHeaders: []string{"Origin", "Authorization", "Uuid", "Accesstoken", "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("/v1",
- web.NSNamespace("/report",
- web.NSInclude(
- &controllers.ReportController{},
- ),
- ),
- web.NSNamespace("/chart_permission",
- web.NSInclude(
- &controllers.ChartPermissionController{},
- ),
- ),
- web.NSNamespace("/chart",
- web.NSInclude(
- &controllers.ChartController{},
- ),
- ),
- web.NSNamespace("/wechat",
- web.NSInclude(
- &controllers.WeChatController{},
- ),
- ),
- web.NSNamespace("/classify",
- web.NSInclude(
- &controllers.ClassifyController{},
- ),
- ),
- )
- nsNoAuth := web.NewNamespace("/v1/noAuth",
- web.NSNamespace("/report",
- web.NSInclude(
- &controllers.ReportNoAuthController{},
- ),
- ),
- )
- web.AddNamespace(ns, nsNoAuth)
- }
|