nps/web/routers/router.go

27 lines
826 B
Go
Raw Permalink Normal View History

2018-12-11 00:37:12 -08:00
package routers
import (
2020-01-08 05:57:14 -08:00
"ehang.io/nps/web/controllers"
2019-08-09 20:10:01 -07:00
"github.com/astaxie/beego"
2018-12-11 00:37:12 -08:00
)
func Init() {
web_base_url := beego.AppConfig.String("web_base_url")
if len(web_base_url) > 0 {
ns := beego.NewNamespace(web_base_url,
beego.NSRouter("/", &controllers.IndexController{}, "*:Index"),
beego.NSAutoRouter(&controllers.IndexController{}),
beego.NSAutoRouter(&controllers.LoginController{}),
beego.NSAutoRouter(&controllers.ClientController{}),
beego.NSAutoRouter(&controllers.AuthController{}),
)
beego.AddNamespace(ns)
} else {
beego.Router("/", &controllers.IndexController{}, "*:Index")
beego.AutoRouter(&controllers.IndexController{})
beego.AutoRouter(&controllers.LoginController{})
beego.AutoRouter(&controllers.ClientController{})
beego.AutoRouter(&controllers.AuthController{})
}
2018-12-11 00:37:12 -08:00
}