Go Gin Example
2018-10-25 10:42
681 查看
https://github.com/EDDYCJY/go-gin-example/blob/master/README_ZH.md
Go Gin Example
gin的一个例子,包含许多有用特性
目录
本项目提供 Gin实践 的连载示例代码
- Gin实践 连载一 Golang介绍与环境安装
- Gin实践 连载二 搭建Blog API's(一)
- Gin实践 连载三 搭建Blog API's(二)
- Gin实践 连载四 搭建Blog API's(三)
- Gin实践 连载五 使用JWT进行身份校验
- Gin实践 连载六 编写一个简单的文件日志
- Gin实践 连载七 Golang优雅重启HTTP服务
- Gin实践 连载八 为它加上Swagger
- Gin实践 连载九 将Golang应用部署到Docker
- Gin实践 连载十 定制 GORM Callbacks
- Gin实践 连载十一 Cron定时任务
- Gin实践 连载十二 优化配置结构及实现图片上传
- Gin实践 连载十三 优化你的应用结构和实现Redis缓存
- Gin实践 连载十四 实现导出、导入 Excel
- Gin实践 连载十五 生成二维码、合并海报
- Gin实践 连载十六 在图片上绘制文字
- Gin实践 连载十七 用 Nginx 部署 Go 应用
- Gin实践 番外 Golang交叉编译
- Gin实践 番外 请入门 Makefile
安装
[code]$ go get github.com/EDDYCJY/go-gin-example
如何运行
必须
- Mysql
- Redis
配置
[code][database] Type = mysql User = root Password = rootroot Host = 127.0.0.1:3306 Name = blog TablePrefix = blog_ [redis] Host = 127.0.0.1:6379 Password = MaxIdle = 30 MaxActive = 30 IdleTimeout = 200 ...
准备
创建一个
blog数据库,并且导入建表的 SQL
运行
[code]$ cd $GOPATH/src/go-gin-example $ go run main.go
项目的运行信息和已存在的 API's
[code][GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production. - using env: export GIN_MODE=release - using code: gin.SetMode(gin.ReleaseMode) [GIN-debug] GET /auth --> github.com/EDDYCJY/go-gin-example/routers/api.GetAuth (3 handlers) [GIN-debug] GET /swagger/*any --> github.com/EDDYCJY/go-gin-example/vendor/github.com/swaggo/gin-swagger.WrapHandler.func1 (3 handlers) [GIN-debug] GET /api/v1/tags --> github.com/EDDYCJY/go-gin-example/routers/api/v1.GetTags (4 handlers) [GIN-debug] POST /api/v1/tags --> github.com/EDDYCJY/go-gin-example/routers/api/v1.AddTag (4 handlers) [GIN-debug] PUT /api/v1/tags/:id --> github.com/EDDYCJY/go-gin-example/routers/api/v1.EditTag (4 handlers) [GIN-debug] DELETE /api/v1/tags/:id --> github.com/EDDYCJY/go-gin-example/routers/api/v1.DeleteTag (4 handlers) [GIN-debug] GET /api/v1/articles --> github.com/EDDYCJY/go-gin-example/routers/api/v1.GetArticles (4 handlers) [GIN-debug] GET /api/v1/articles/:id --> github.com/EDDYCJY/go-gin-example/routers/api/v1.GetArticle (4 handlers) [GIN-debug] POST /api/v1/articles --> github.com/EDDYCJY/go-gin-example/routers/api/v1.AddArticle (4 handlers) [GIN-debug] PUT /api/v1/articles/:id --> github.com/EDDYCJY/go-gin-example/routers/api/v1.EditArticle (4 handlers) [GIN-debug] DELETE /api/v1/articles/:id --> github.com/EDDYCJY/go-gin-example/routers/api/v1.DeleteArticle (4 handlers) Listening port is 8000 Actual pid is 4393
Swagger 文档
特性
- RESTful API
- Gorm
- Swagger
- logging
- Jwt-go
- Gin
- Graceful restart or stop (fvbock/endless)
- App configurable
- Cron
- Redis
相关文章推荐
- Go by Example: Recursion
- go的gin框架的性能测试
- go语言web框架gin 从请求中取参数
- golang实战使用gin+xorm搭建go语言web框架restgo详解5.6 控制器参数校验
- golang实战使用gin+xorm搭建go语言web框架restgo详解10 使用restgo搭建后台管理系统
- Go by Example: Switch
- Go Gin 框架 curl -I 返回 404 的问题
- Go WebServer Example
- golang实战使用gin+xorm搭建go语言web框架restgo详解5.7 控制器数据响应
- java程序员10分钟可上手的golang框架golang实战使用gin+xorm搭建go语言web框架restgo
- Go by Example: Hello World
- Go by Example: Constants
- Go by Example: Arrays
- go by example 之arrays.go
- go服务端----使用gin框架搭建简易服务
- go--gin
- Go语言 如何使用gin框架的中间件做身份验证~~~
- golang实战使用gin+xorm搭建go语言web框架restgo详解5.9 控制器controller编程示例
- Go by Example: Values
- Go by Example: Slices