router.go 1.0 KB
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")
	}

    {
		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)
}