pyama86 / tollbooth_echo

Tollbooth - Echo integration layer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tollbooth_echo

Echo middleware for rate limiting HTTP requests.

Note

This shim uses v1.0.0 API.

Five Minutes Tutorial

package main

import (
	"time"

	"github.com/didip/tollbooth/thirdparty/tollbooth_echo"
	"github.com/didip/tollbooth"
	"github.com/webx-top/echo"
	"github.com/webx-top/echo/engine/standard"
)

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

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

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

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

About

Tollbooth - Echo integration layer


Languages

Language:Go 100.0%