本文整理汇总了Golang中github.com/labstack/echo.Echo.Group方法的典型用法代码示例。如果您正苦于以下问题:Golang Echo.Group方法的具体用法?Golang Echo.Group怎么用?Golang Echo.Group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/labstack/echo.Echo
的用法示例。
在下文中一共展示了Echo.Group方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: apiRoute
// apiRoute contains router groups for API
func (a *App) apiRoute(e *echo.Echo) error {
apiUrl, err := a.conf.Get("api-url")
if err != nil {
return err
}
//General API
g := e.Group(apiUrl.(string))
//auth
g.Post("/auth", a.login)
//oauth
a.fb, err = oauth.NewFacebook(a)
if err != nil {
return err
}
fbg := g.Group("/oauth")
fbg.Get("/facebook", a.facebookAuth)
fbg.Get("/facebook/redirect", a.facebookRedirect)
//tasks
tokenizer := jwt.NewTokenizer(a)
tg := g.Group("/tasks", tokenizer.Check())
tg.Post("", a.create)
tg.Get("/:id", a.retrieve)
tg.Get("", a.retrieveAll)
tg.Put("/:id", a.update)
tg.Delete("/:id", a.delete)
return nil
}
示例2: registerRouterHandler
func registerRouterHandler(e *echo.Echo) {
a := e.Group("/admin")
a.Get("/:id", func(c *echo.Context) error {
return c.String(http.StatusOK, "/admin/"+c.Param("id"))
})
a.Get("/users/:name", func(c *echo.Context) error {
return c.String(http.StatusOK, c.Param("name"))
})
a.Post("/login", login)
}
示例3: SetRouting
func SetRouting(e *echo.Echo) {
log.Info("Start set api's routing")
g := e.Group("/api")
// Members
g.Get("/members", GetAllMembers())
g.Get("/members/:id", GetMember())
g.Post("/members", CreateMember())
// Iterations
g.Get("/iterations", GetAllIterations())
g.Get("/iterations/:id/tasks", GetIterationTasks())
g.Post("/iterations", CreateIteration())
// Task
g.Post("/tasks", CreateTask())
}
示例4: RegisterController
func RegisterController(name string, e *echo.Echo, m []echo.Middleware, dal DataAccessLayer, config Config) {
rc := NewResourceController(name, dal)
rcBase := e.Group("/" + name)
rcBase.Get("", rc.IndexHandler)
rcBase.Post("", rc.CreateHandler)
rcBase.Delete("", rc.ConditionalDeleteHandler)
rcItem := rcBase.Group("/:id")
rcItem.Get("", rc.ShowHandler)
rcItem.Put("", rc.UpdateHandler)
rcItem.Delete("", rc.DeleteHandler)
if len(m) > 0 {
rcBase.Use(m...)
}
if config.UseSmartAuth {
rcBase.Use(SmartAuthHandler(name))
}
}
示例5: InitAuthWebServices
// InitAuthWebServices Wire Auth Services ...
func InitAuthWebServices(app *echo.Echo) {
gProvider := app.Group("/auth")
gProvider.Get("", getProviders)
gProvider.Get("/:provider", redirectHandler)
gProvider.Get("/:provider/callback", callbackHandler)
}