router.go
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package routers
import (
"github.com/astaxie/beego"
"github.com/prometheus/client_golang/prometheus/promhttp"
"gitlab.fjmaimaimai.com/mmm-go/ability/controllers/v1"
)
var nsV1 *beego.Namespace
func init() {
nsV1=beego.NewNamespace("/v1")
/*user controller*/
{
user :=&v1.UserController{}
nsV1.Router("/user/login",user,"post:Login")
}
/*auth controller*/
{
auth :=&v1.AuthController{}
nsV1.Router("/auth/login",auth,"post:Login")
nsV1.Router("/auth/accessToken",auth,"post:AccessToken")
nsV1.Router("/auth/refreshToken",auth,"post:RefreshToken")
nsV1.Router("/auth/smsCode",auth,"post:SmsCode")
}
/*image controller*/
{
upload :=&v1.UploadController{}
nsV1.Router("/upload/image",upload,"post:Image")
nsV1.Router("/upload/voice",upload,"post:Voice")
}
{
version :=&v1.VersionController{}
nsV1.Router("/version/getLatestVersionInfo",version,"post:GetLatestVersionInfo")
}
beego.SetStaticPath("/file/ab",beego.AppConfig.String("source_path"))
beego.Handler("/metrics", promhttp.Handler())
beego.AddNamespace(nsV1)
}