Ejemplo n.º 1
0
func init() {
	beego.Router("/", &base.BaseController{}, "get:Redt")
	beego.Router("/login", &auth.AuthController{}, "get:LoginGet;post:LoginPost")
	beego.Router("/logout", &auth.AuthController{}, "get:LogOut")
	//	beego.Router("/register",&auth.AuthController{},"get:RegisterGet;post:RegisterPost")
	loginRequired :=
		beego.NewNamespace("/log",
			beego.NSCond(func(ctx *context.Context) bool {
				return true
			}),
			beego.NSBefore(base.FilterLoginUser),
			beego.NSRouter("/all", &home.HomeController{}, "get:GetSyslog;post:GetSyslogBySearch"),
			beego.NSRouter("/search", &home.HomeController{}, "*:GetSyslogBySearch"),
			beego.NSRouter("/detail", &home.HomeController{}, "get:GetDetails"),
			beego.NSRouter("/profile", &user.UserController{}, "get:GetUserProfile;post:EditUserInfo"),
			beego.NSRouter("/profile/user", &user.UserController{}, "get:QueryUser;post:UpdateUser"),
			beego.NSRouter("/profile/changepwd", &user.UserController{}, "post:ChangePwd"),
			beego.NSRouter("/manager", &user.ManagerController{}, "get:GetUserManager"),
			beego.NSRouter("/manager/search", &user.ManagerController{}, "*:SearchUserSyslog"),
			beego.NSRouter("/manager/detail", &user.ManagerController{}, "*:UserSyslogDetail"),
			beego.NSRouter("/manager/add", &user.ManagerController{}, "post:AddIp"),
			beego.NSRouter("/manager/remove", &user.ManagerController{}, "post:RemoveIp"),
			beego.NSRouter("/download", &controllers.DownLoader{}, "get:Get"),
		)
	beego.AddNamespace(loginRequired)
}
Ejemplo n.º 2
0
func main() {
	beego.Router("/", &controllers.MainController{})
	beego.Router("/ws", &controllers.WSController{})
	beego.Run()
}