Exemplo n.º 1
0
// Configure setups all resource functions in order to work with database operations
func Configure(g *echo.Group) {
	g.Use(auth.AnyAuth())
	g.Post("/", msg.JSONResource(Create))
	g.Get("/:id", msg.JSONResource(Retrieve))
	g.Patch("/:id", msg.JSONResource(Update))
	g.Delete("/:id", msg.JSONResource(Delete))
}
Exemplo n.º 2
0
// 注册路由
func (self AccountController) RegisterRoute(g *echo.Group) {
	g.Any("/account/register", self.Register)
	g.Post("/account/send_activate_email", self.SendActivateEmail)
	g.Get("/account/activate", self.Activate)
	g.Any("/account/login", self.Login)
	g.Any("/account/edit", self.Edit, middleware.NeedLogin())
	g.Post("/account/change_avatar", self.ChangeAvatar, middleware.NeedLogin())
	g.Post("/account/changepwd", self.ChangePwd, middleware.NeedLogin())
	g.Any("/account/forgetpwd", self.ForgetPasswd)
	g.Any("/account/resetpwd", self.ResetPasswd)
	g.Get("/account/logout", self.Logout, middleware.NeedLogin())
}
Exemplo n.º 3
0
// Configure will set all routes needed by this module
func Configure(g *echo.Group) {
	g.Use(auth.AnyAuth())
	g.Get("/", msg.JSONResource(List))
	g.Get("/:gid", msg.JSONResource(Create))
	g.Post("/:gid", msg.JSONResource(Retrieve))
	g.Patch("/:gid", msg.JSONResource(Update))
	g.Delete("/:gid", msg.JSONResource(Delete))

	g.Post("/:gid/members/:mid", msg.JSONResource(AddMember))
	g.Post("/:gid/members/:mid/admin", msg.JSONResource(AddAdmin))
	g.Delete("/:gid/members/:mid/admin", msg.JSONResource(DelAdmin))
	g.Delete("/:gid/members/:mid", msg.JSONResource(DelMember))
}
Exemplo n.º 4
0
Arquivo: main.go Projeto: mewben/onix
// APIRoutes definition
// ========== API ROUTES ======
func APIRoutes(api *echo.Group) {

	// ======= ADMIN API ======
	admin := controllers.AdminController{}
	api.Get("/time", admin.GetTime)

	posts := controllers.PostsController{}
	api.GET("/posts/:id", posts.GetOne)
	api.GET("/posts", posts.Get)
	api.POST("/posts", posts.Save)
	api.PUT("/posts/:id", posts.Update)

	// CRUD /api/tags
	tags := controllers.TagsController{}
	api.GET("/tags/:id", tags.GetOne)
	api.GET("/tags", tags.Get)
	api.POST("/tags", tags.Save)
	api.PUT("/tags/:id", tags.Update)
	/*	api.Delete("/tags/:id", tags.Destroy)
	 */
}
Exemplo n.º 5
0
// 注册路由
func (self FavoriteController) RegisterRoute(g *echo.Group) {
	g.Post("/favorite/:objid", self.Create, middleware.NeedLogin())
	g.Get("/favorites/:username", self.ReadList)
}
Exemplo n.º 6
0
// Bind attaches api routes
func (api *API) Bind(group *echo.Group) {
	group.Get("/v1/conf", api.ConfHandler)
}
Exemplo n.º 7
0
// 注册路由
func (this *ArticleController) RegisterRoute(g *echo.Group) {
	g.Get("/articles", this.ReadList)
	g.Get("/articles/:id", this.Detail)
}
Exemplo n.º 8
0
// User related endpoints
func registerUserHandlers(router *echo.Group, userService handler.UserService) {
	router.Get("/users/:id", userService.Show)
	router.Get("/users", userService.List)
	router.Post("/users", userService.Create)
}
Exemplo n.º 9
0
func (self CommentController) RegisterRoute(g *echo.Group) {
	g.Get("/at/users", self.AtUsers)
	g.Post("/comment/:objid", self.Create, middleware.NeedLogin(), middleware.Sensivite(), middleware.PublishNotice())
	g.Get("/object/comments", self.CommentList)
}
Exemplo n.º 10
0
func (self CaptchaController) RegisterRoute(g *echo.Group) {
	g.Get("/captcha/*", self.Server)
}