Skip to content

easonlin404/limit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Limit Gin's middleware

Travis branch Codecov branch Go Report Card GoDoc

Gin middleware to limit the number of current requests.

Usage

Start using it

Download and install it:

$ go get github.com/easonlin404/limit

Import it in your code:

import "github.com/easonlin404/limit"

Canonical example:

package main

import (
	"github.com/easonlin404/limit"
	"github.com/gin-gonic/gin"
)

func main() {

	r := gin.Default()
	r.Use(limit.Limit(200)) // limit the number of current requests

	r.GET("/", func(c *gin.Context) {
		// your code
	})

	r.Run()
}

About

Gin middleware to limit the number of current requests.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages