echo

Echo

Used in 44 go projects (avg ★724)

Go
framework
Used by 44 projects

Details

Language / Topic
goGo
Category
framework
Compatible Frameworks
echo

Rules

balanced
- Initialize the Echo instance with `e := echo.New()`.
- Define routes using methods like `e.GET(path, handler)`, `e.POST(path, handler)`.
- Start the server via `e.Start(addr)` or `e.StartTLS(addr, cert, key)`.
- Access request context in handlers with `c *echo.Context`.
- Organize routes with groups: `g := e.Group("/api")`; then `g.GET("/users", handler)`.
- Handle JSON binding and validation: `var user User; if err := c.Bind(&user); err != nil { ... }`.
- Apply global middleware: `e.Use(middleware.Logger(), middleware.Recover())`.
- Return JSON responses: `c.JSON(http.StatusOK, map[string]interface{}{"data": data})`.
- Use `c.Param("id")` or `c.QueryParam("q")` for path and query parameters.