Skip to content

didip/tollbooth_gin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

tollbooth_gin

Gin middleware for rate limiting HTTP requests.

Five Minutes Tutorial

package main

import (
    "github.com/didip/tollbooth"
    "github.com/didip/tollbooth_gin"
    "github.com/gin-gonic/gin"
    "time"
)

func main() {
    r := gin.New()

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

    r.GET("/", tollbooth_gin.LimitHandler(limiter), func(c *gin.Context) {
        c.String(200, "Hello, world!")
    })

    r.Run(":12345")
}

About

Tollbooth - Gin integration layer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages