Skip to content

didip/tollbooth_iris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

tollbooth_iris

Iris middleware for rate limiting HTTP requests.

Five Minutes Tutorial

package main

import (
    "time"

    "github.com/didip/tollbooth"
    "github.com/didip/tollbooth_iris"

    "gopkg.in/kataras/iris.v6"
    "gopkg.in/kataras/iris.v6/adaptors/httprouter"
)

func main() {
    app := iris.New()
    app.Adapt( httprouter.New() )
    
    // Create a limiter struct.
    limiter := tollbooth.NewLimiter(1, nil)

    app.Get("/", tollbooth_iris.LimitHandler(limiter), func(ctx *iris.Context) {
        ctx.WriteString("Hello, world!")
    })

    app.Listen(":8080")
}

About

Tollbooth - Iris integration layer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages