package
1.22.4
Repository: https://github.com/webx-top/echo.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

tollbooth_echo

Echo middleware for rate limiting HTTP requests.

Five Minutes Tutorial

package main

import (
	"time"

	"github.com/webx-top/echo"
	"github.com/webx-top/echo/engine/standard"
	"github.com/webx-top/echo/middleware/ratelimit"
)

func main() {
	e := echo.New()

	// Create a limiter struct.
	limiter := ratelimit.NewLimiter(1, time.Second)

	e.Get("/", echo.HandlerFunc(func(c echo.Context) error {
		return c.String(200, "Hello, World!")
	}), ratelimit.LimitHandler(limiter))

	e.Run(standard.New(":4444"))
}