摘要: Gin封装的最好的地方就是context和对response的处理。本篇文章主要解释context的使用方法, 以及其设计原理 将Request的处理封装到Context中优点 在阅读gin的源码时, 请求的处理是使用type HandlerFunc func(*Context)来处理的. 也就是 阅读全文
posted @ 2020-11-24 23:16 Mr.peter 阅读(18287) 评论(0) 推荐(1)
摘要: Gin的是路由算法其实就是一个Trie树(也就是前缀树)。 注册路由预处理 我们在使用gin时通过下面的代码注册路由 普通注册 router.POST("/somePost", func(context *gin.Context) { context.String(http.StatusOK, "s 阅读全文
posted @ 2020-11-24 22:30 Mr.peter 阅读(499) 评论(0) 推荐(0)