command
module
Version:
v0.0.0-...-9d33de4
Opens a new window with list of versions in this module.
Published: Mar 28, 2020
License: Apache-2.0
Opens a new window with license information.
Imports: 8
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Go API Service
基于Gin构建的土拨鼠社区基础服务
![Go](https://github.com/opensourceai/go-api-service/workflows/Go/badge.svg)
How to run
Required
本地部署.使用test/docker-compose.yaml
本地部署
Conf
配置文件 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
...
配置环境变量
Run
$ 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
Swagger
swag init # 生成文档
Swagger doc: http://localhost:8000/swagger/index.html
Test Api
[GET] /auth Get Auth
- userName:hive
- password:hive
Dev
-
fork repository
-
clone repository
# [git@github.com:chenquan/go-api-service.git]为自己账户下仓库地址
git clone git@github.com:chenquan/go-api-service.git
cd go-api-service
-
开发新功能前必须拉去主库代码到本地master
- 新建远程库连接(
只需第一次clone之后设置
)
git remote add opensourceai git@github.com:opensourceai/go-api-service.git
- 拉取主库最新master代码到本地master
git pull opensourceai master:master --rebase -f
-
开发新功能/修改
- 从本地master分支新建出
feature-*
(fix-*
)分支(*
表示对应新功能名称)
- 开发完毕之后,push到自己账号下的仓库
- 通过PR使用squash方式合并到主库
-
后续开发循环3
,4
Features
- RESTful API
- Gorm
- Swagger
- logging
- Jwt-go
- Gin
- Graceful restart or stop (fvbock/endless)
- App configurable
- Cron
- Redis
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
|
|
|
|
v1/dto
* @Package dto * @Author Quan Chen * @Date 2020/3/19 * @Description * * @Package dto * @Author Quan Chen * @Date 2020/3/19 * @Description 公共的数据传输结构体 * * @Package dto * @Author Quan Chen * @Date 2020/3/19 * @Description 用户相关数据传输结构体 *
|
* @Package dto * @Author Quan Chen * @Date 2020/3/19 * @Description * * @Package dto * @Author Quan Chen * @Date 2020/3/19 * @Description 公共的数据传输结构体 * * @Package dto * @Author Quan Chen * @Date 2020/3/19 * @Description 用户相关数据传输结构体 * |
v1/vo
* @Package vo * @Author Quan Chen * @Date 2020/3/19 * @Description *
|
* @Package vo * @Author Quan Chen * @Date 2020/3/19 * @Description * |
internal
|
|
|
|
dao/do
* @Package do * @Author Quan Chen * @Date 2020/3/19 * @Description * * @Package do * @Author Quan Chen * @Date 2020/3/19 * @Description *
|
* @Package do * @Author Quan Chen * @Date 2020/3/19 * @Description * * @Package do * @Author Quan Chen * @Date 2020/3/19 * @Description * |
|
|
|
|
|
|
middleware
|
|
|
|
pkg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.