2016-05-15 11:57:04 +00:00
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gin-gonic/gin"
|
2016-08-15 11:45:42 +00:00
|
|
|
"github.com/jmoiron/sqlx"
|
2016-05-15 11:57:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// PeppyMethod generates a method for the peppyapi
|
2016-08-15 11:45:42 +00:00
|
|
|
func PeppyMethod(a func(c *gin.Context, db *sqlx.DB)) gin.HandlerFunc {
|
2016-05-15 11:57:04 +00:00
|
|
|
return func(c *gin.Context) {
|
2016-07-06 14:33:58 +00:00
|
|
|
rateLimiter()
|
2016-07-06 17:36:46 +00:00
|
|
|
perUserRequestLimiter(0, c.ClientIP())
|
2016-07-06 14:33:58 +00:00
|
|
|
|
2016-05-15 11:57:04 +00:00
|
|
|
// I have no idea how, but I manged to accidentally string the first 4
|
|
|
|
// letters of the alphabet into a single function call.
|
|
|
|
a(c, db)
|
|
|
|
}
|
|
|
|
}
|