Optimized Router
Radix-tree routing with zero dynamic allocation and smart route prioritization.
A high-performance, minimalist Go web framework — a zero-allocation router, batteries-included middleware, and an expressive API. Ship production services in minutes.
go get github.com/labstack/echo/v5e := echo.New()
// Middlewaree.Use(middleware.RequestLogger())e.Use(middleware.Recover())
// Route => handlere.GET("/", func(c *echo.Context) error { return c.String(http.StatusOK, "Hello, World!\n")})Create a module and add Echo.
go mod init myappgo get github.com/labstack/echo/v5Save the Hello World server as server.go.
package main
import ( "context" "net/http"
"github.com/labstack/echo/v5" "github.com/labstack/echo/v5/middleware")
func main() { // Echo instance e := echo.New()
// Middleware e.Use(middleware.RequestLogger()) e.Use(middleware.Recover())
// Route => handler e.GET("/", func(c *echo.Context) error { return c.String(http.StatusOK, "Hello, World!\n") })
// Start server sc := echo.StartConfig{Address: ":1323"} if err := sc.Start(context.Background(), e); err != nil { e.Logger.Error("failed to start server", "error", err) }}Fetch dependencies and start serving on port 1323.
go mod tidygo run server.goHigh performance, extensible, minimalist Go web framework.