API Reference

Echo

High performance, extensible Go web framework with minimal overhead and good documentation.

Official Documentation ↗
CompatibilityThis documentation covers version v4.12. Check the official docs for the latest API surface.

Installation

gogo get github.com/labstack/echo/v4

Methods

Echo is a high performance, extensible, minimalist web framework for Go. It provides a clean API, built-in middleware, request binding, and centralized error handling with minimal overhead.

Key Features

  • Fast: Optimized router with zero allocations in hot paths
  • Middleware: Logger, recover, CORS, auth, and more
  • Binding: Automatic binding by Content-Type
  • Grouping: Route groups with shared middleware
  • Error handling: Centralized HTTPErrorHandler

FAQ

How does Echo compare to Gin?
Both are fast Go frameworks with similar APIs. Echo has more built-in middleware and a slightly richer context API. Gin has a larger community and marginally higher throughput. Either is a solid choice for production APIs.
How do I customize error handling in Echo?
Set e.HTTPErrorHandler to a function taking error and echo.Context. You can inspect echo.HTTPError to set status and message, and log unexpected errors centrally.
Does Echo support request validation?
Echo itself does not bundle a validator. Use c.Validate(i) after setting e.Validator with a struct implementing echo.Validator, typically wrapping go-playground/validator for tag-based validation.