router.go 838 字节
package routers

import (
	"github.com/astaxie/beego"
	"openapi/pkg/constant"
	"openapi/pkg/port/beego/controllers"
	"openapi/pkg/port/beego/controllers/v1"
	v2 "openapi/pkg/port/beego/controllers/v2"
)

var nsV1 *beego.Namespace

func init() {
	nsV1 := beego.NewNamespace("v1",
		beego.NSNamespace("vod", beego.NSBefore(controllers.AllowOption), beego.NSInclude(&v1.VodController{})),
		beego.NSNamespace("push", beego.NSBefore(controllers.AllowOption), beego.NSInclude(&v1.PushController{})),
		beego.NSNamespace("sms", beego.NSBefore(controllers.AllowOption), beego.NSInclude(&v1.SmsController{})),
	)
	beego.SetStaticPath("/log", constant.LogFilePath)
	beego.Router("/v2/vod/createStsAuth", &v2.VodController{}, "Post:CreateStsAuth")
	beego.AddNamespace(nsV1)

	beego.InsertFilter("/*", beego.BeforeRouter, controllers.AllowCors())
}