package LeYouTu import ( "github.com/gin-gonic/gin" ) type Controllers struct { Layout func(c *gin.Context) bool } func (this *Controllers) POST(handFunc func(c *gin.Context)) func(c *gin.Context) { return this.HandleFunc(handFunc, "POST") } func (this *Controllers) GET(handFunc func(c *gin.Context)) func(c *gin.Context) { return this.HandleFunc(handFunc, "GET") } func (this *Controllers) HandleFunc(handFunc func(c *gin.Context), httpMethod string) func(c *gin.Context) { return func(c *gin.Context) { if c.Request.Method != httpMethod { //res.Write([]byte(http.StatusText(http.StatusMethodNotAllowed))) return } } }