https://github.com/zcong1993/gin-ratelimit
ratelimit middleware for gin
https://github.com/zcong1993/gin-ratelimit
Last synced: 6 months ago
JSON representation
ratelimit middleware for gin
- Host: GitHub
- URL: https://github.com/zcong1993/gin-ratelimit
- Owner: zcong1993
- License: mit
- Created: 2018-04-22T16:56:46.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-11-03T09:28:33.000Z (almost 5 years ago)
- Last Synced: 2025-04-07T08:15:47.480Z (6 months ago)
- Language: Go
- Size: 7.81 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gin-ratelimit [](https://goreportcard.com/report/github.com/zcong1993/gin-ratelimit) [](https://circleci.com/gh/zcong1993/gin-ratelimit/tree/master) [](https://codecov.io/gh/zcong1993/gin-ratelimit)
> ratelimit middleware for gin
**IMPORTANT:** DO NOT USE IT IN PRODUCTION!!! USE [https://github.com/ulule/limiter](https://github.com/ulule/limiter)
## Install
```sh
$ go get -v github.com/zcong1993/gin-ratelimit
```## Usage
```go
func main() {
router := gin.New()
router.Use(ratelimit.Default())
router.GET("/", func(c *gin.Context) {
c.String(200, testResp)
})
router.Run(":8080")
}
``````go
func main() {
router := gin.New()
router.Use(ratelimit.New(ratelimit.Config{Duration: 1, RateLimit: 1}))
router.GET("/", func(c *gin.Context) {
c.String(200, testResp)
})
router.Run(":8080")
}
```## License
MIT © zcong1993