![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Gin框架
Samdom
这个作者很懒,什么都没留下…
展开
-
Gin框架入门(一)—HTTP请求
官方文档:https://godoc.org/github.com/gin-gonic/gin官方地址:https://github.com/gin-gonic/gin1.开始安装先配置好GOROOT和GOPATH输入命令:go get github.com/gin-gonic/gin2.简单示例//导入包 import ( "github.com/gin-gonic/gin&a原创 2019-01-25 14:38:26 · 10622 阅读 · 4 评论 -
Gin框架入门(二)—文件上传
官方文档:https://godoc.org/github.com/gin-gonic/gin官方地址:https://github.com/gin-gonic/gin测试工具:postman https://www.getpostman.com/downloads/1.单文件上传func main() { router := gin.Default() router.POST("/u...原创 2019-01-25 16:27:08 · 10726 阅读 · 2 评论 -
Gin框架入门(三)—多路由分组
官方文档:https://godoc.org/github.com/gin-gonic/gin官方地址:https://github.com/gin-gonic/gin多路由分组在平常我们经常会划分一个模块一组路由。例如:goods为商品模块www.haha.com/goods/addGoods 添加商品www.haha.com/goods/delGoods 删除商品这时我们把一...原创 2019-01-25 17:11:52 · 12894 阅读 · 4 评论 -
Gin框架入门(四)—中间件
官方文档:https://godoc.org/github.com/gin-gonic/gin官方地址:https://github.com/gin-gonic/gin无中间件func main() {//创建一个无中间件路由router := gin.New()router.Run()}默认中间件func main() {// 默认启动方式,包含 Logger、Recove...原创 2019-06-10 16:26:15 · 13790 阅读 · 4 评论 -
Gin框架入门(五)—日志
官方文档:https://godoc.org/github.com/gin-gonic/gin官方地址:https://github.com/gin-gonic/gin日志的输出func main() { //禁用控制台颜色,在将日志写入文件时不需要控制台颜色 gin.DisableConsoleColor() //如果需要将日志写入文件,请使用以下代码 //创建日志文件 f,...原创 2019-06-11 14:09:12 · 2009 阅读 · 1 评论