router.go
679 字节
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.AddNamespace(nsV1)
beego.SetStaticPath("/file/ab", beego.AppConfig.String("source_path"))
beego.Handler("/metrics", promhttp.Handler())
beego.Handler("/upgrage", http.HandlerFunc(websocket.Upgrage))
}