router.go 967 字节
package routers

import (
	"github.com/astaxie/beego"
	"github.com/prometheus/client_golang/prometheus/promhttp"
	"net/http"
	"opp/controllers/v1"
	"opp/services/websocket"
)

var nsV1 *beego.Namespace

func init() {
	nsV1 := beego.NewNamespace("v1",
		beego.NSNamespace("auth", beego.NSInclude(&v1.AuthController{})),
		beego.NSNamespace("upload", beego.NSInclude(&v1.UploadController{})),
		beego.NSNamespace("version", beego.NSInclude(&v1.VersionController{})),
		beego.NSNamespace("commend", beego.NSInclude(&v1.CommendController{})),
		beego.NSNamespace("user", beego.NSInclude(&v1.UserController{})),
		beego.NSNamespace("chance", beego.NSInclude(&v1.ChanceController{})),
		beego.NSNamespace("message", beego.NSInclude(&v1.MessageController{})),
	)
	beego.AddNamespace(nsV1)
	beego.SetStaticPath("/file/ab", beego.AppConfig.String("source_path"))
	beego.Handler("/metrics", promhttp.Handler())
	beego.Handler("/upgrage", http.HandlerFunc(websocket.Upgrage))
}