示例#1
0
func (r *studentRouter) initRoutes() {
	r.routes = []router.Route{
		router.NewGetRoute(
			"student/findAll",
			r.FindAllAvailable,
			true,
			[]string{"ADMIN"},
			httputils.API,
		),
		router.NewGetRoute(
			"student/findById/{id:[0-9]+}",
			r.FindById,
			true,
			[]string{"ADMIN"},
			httputils.API,
		),
		router.NewPostRoute(
			"student/edit/",
			r.Edit,
			true,
			[]string{"ADMIN"},
			httputils.API,
		),
		router.NewPostRoute(
			"student/create/",
			r.Create,
			true,
			[]string{"ADMIN"},
			httputils.API,
		),
	}
}
示例#2
0
func (r *staticRouter) initRoutes() {
	r.routes = []router.Route{
		router.NewGetRoute(
			"/",
			r.Index,
			false,
			[]string{},
			httputils.Static,
		),
	}
}
示例#3
0
func (r *userRouter) initRoutes() {
	r.routes = []router.Route{
		router.NewGetRoute(
			"user/findAll/",
			r.FindAllAvailable,
			true,
			[]string{"ADMIN"},
			httputils.API,
		),
		router.NewGetRoute(
			"user/findById/{id:[0-9]+}",
			r.FindById,
			true,
			[]string{"ADMIN"},
			httputils.API,
		),
		router.NewGetRoute(
			"user/findByUsername/{username:[0-9a-zA-Z]+}",
			r.FindByUsername,
			true,
			[]string{"ADMIN"},
			httputils.API,
		),
		router.NewPostRoute(
			"user/edit/",
			r.Edit,
			true,
			[]string{"ADMIN"},
			httputils.API,
		),
		router.NewPostRoute(
			"user/create/",
			r.Create,
			true,
			[]string{"ADMIN"},
			httputils.API,
		),
		router.NewPostRoute(
			"user/changePassword/",
			r.ChangePassword,
			true,
			[]string{"ADMIN"},
			httputils.API,
		),
		router.NewPostRoute(
			"user/delete/",
			r.Delete,
			true,
			[]string{"ADMIN"},
			httputils.API,
		),
		router.NewGetRoute(
			"user/profile/",
			r.GetProfileForCurrentUser,
			true,
			[]string{},
			httputils.API,
		),
		router.NewPostRoute(
			"user/current/changePassword/",
			r.ChangePasswordForCurrentUser,
			true,
			[]string{},
			httputils.API,
		),
		router.NewPostRoute(
			"user/current/changeEmail/",
			r.ChangeEmailForCurrentUser,
			true,
			[]string{},
			httputils.API,
		),
		router.NewPostRoute(
			"user/current/changeFullName/",
			r.ChangeFullNameForCurrentUser,
			true,
			[]string{},
			httputils.API,
		),
		router.NewGetRoute(
			"user/current/privileges/",
			r.GetPrivilegesForCurrentUser,
			true,
			[]string{},
			httputils.API,
		),
	}
}