router.go
1.4 KB
package routers
import (
"github.com/astaxie/beego"
"github.com/prometheus/client_golang/prometheus/promhttp"
"opp/controllers"
"opp/controllers/v1"
)
var nsV1 *beego.Namespace
func init() {
nsV1 := beego.NewNamespace("v1",
beego.NSNamespace("ucenter", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.UcenterController{})),
beego.NSNamespace("auth", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.AuthController{})),
beego.NSNamespace("upload", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.UploadController{})),
beego.NSNamespace("version", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.VersionController{})),
beego.NSNamespace("commend", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.CommendController{})),
beego.NSNamespace("user", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.UserController{})),
beego.NSNamespace("chance", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.ChanceController{})),
beego.NSNamespace("message", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.MessageController{})),
beego.NSNamespace("department", beego.NSBefore(controllers.FilterComm), beego.NSInclude(&v1.DepartmentController{})),
)
beego.AddNamespace(nsV1)
beego.SetStaticPath("/file/opp", beego.AppConfig.String("source_path"))
beego.Handler("/metrics", promhttp.Handler())
//beego.Handler("/upgrage", http.HandlerFunc(websocket.Upgrage))
}