Skip to content

ReneWerner87/limiter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install

go get -u github.com/gofiber/fiber
go get -u github.com/gofiber/limiter

Example

package main

import (
  "github.com/gofiber/fiber"
  "github.com/gofiber/limiter"
)

func main() {
  app := fiber.New()

  // 3 requests per 10 seconds max
  cfg := limiter.Config{
    Timeout: 10,
    Max: 3,
  }

  app.Use(limiter.New(cfg))

  app.Get("/", func(c *fiber.Ctx) {
    c.Send("Welcome!")
  })

  app.Listen(3000)
}

Test

curl http://localhost:3000
curl http://localhost:3000
curl http://localhost:3000
curl http://localhost:3000

Third party implementations

Limiter with Redis suppport

About

🧬 Limiter middleware for Fiber

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%