基于Gin构建的土拨鼠社区基础服务
- Mysql:线上已部署
- Redis
本地部署.使用
test/docker-compose.yaml本地部署
配置文件 conf/app.ini
[database]
Type = mysql
User = root
Password = root 
Host = 127.0.0.1:3306
Name = blog
TablePrefix = blog_
[redis]
Host = 127.0.0.1:6379
Password =
MaxIdle = 30
MaxActive = 30
IdleTimeout = 200
...
配置环境变量
- GO111MODULE=on
- GOPROXY=https://goproxy.io
$ cd c/go-api-service
$ go run main.go 
项目信息和现有API
[info] replacing callback `gorm:update_time_stamp` from D:/opensourceai/go-api-service/dao/mysql/dao.go:32
[info] replacing callback `gorm:update_time_stamp` from D:/opensourceai/go-api-service/dao/mysql/dao.go:33
[info] replacing callback `gorm:delete` from D:/opensourceai/go-api-service/dao/mysql/dao.go:34
[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    /export/*filepath         --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers)
[GIN-debug] HEAD   /export/*filepath         --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers)
[GIN-debug] GET    /upload/images/*filepath  --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers)
[GIN-debug] HEAD   /upload/images/*filepath  --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers)
[GIN-debug] GET    /qrcode/*filepath         --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers)
[GIN-debug] HEAD   /qrcode/*filepath         --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers)
[GIN-debug] GET    /auth                     --> github.com/opensourceai/go-api-service/routers/api.GetAuth (3 handlers)
[GIN-debug] GET    /swagger/*any             --> github.com/swaggo/gin-swagger.WrapHandler.func1 (3 handlers)
[GIN-debug] POST   /upload                   --> github.com/opensourceai/go-api-service/routers/api.UploadImage (3 handlers)
[info] start http server listening :8000
swag init # 生成文档Swagger doc: http://localhost:8000/swagger/index.html
[GET] /auth Get Auth
- userName:hive
- password:hive
- 
fork repository 
- 
clone repository # [[email protected]:chenquan/go-api-service.git]为自己账户下仓库地址 git clone [email protected]:chenquan/go-api-service.git cd go-api-service 
- 
开发新功能前必须拉去主库代码到本地master - 新建远程库连接(只需第一次clone之后设置)
 git remote add opensourceai [email protected]:opensourceai/go-api-service.git - 拉取主库最新master代码到本地master
 git pull opensourceai master:master --rebase -f 
- 新建远程库连接(
- 
开发新功能/修改 - 从本地master分支新建出feature-*(fix-*)分支(*表示对应新功能名称)
- 开发完毕之后,push到自己账号下的仓库
- 通过PR使用squash方式合并到主库
 
- 从本地master分支新建出
- 
后续开发循环 3,4
- RESTful API
- Gorm
- Swagger
- logging
- Jwt-go
- Gin
- Graceful restart or stop (fvbock/endless)
- App configurable
- Cron
- Redis
- GoLand