Documentation
¶
Overview ¶
Package ratelimit is a HTTP middleware that limit API usage of each user.
Example
package main
import (
"time"
"log"
"github.com/go-gem/gem"
"github.com/go-gem/middleware-rate-limit"
)
func main() {
router := gem.NewRouter()
router.GET("/", func(ctx *gem.Context) {
ctx.HTML(200, "hello")
}, &gem.HandlerOption{
Middlewares:[]gem.Middleware{
ratelimit.New(60, time.Minute),
},
})
log.Println(gem.ListenAndServe(":8080", router.Handler()))
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.