$ v=1.2.1; curl -L --fail https://raw.githubusercontent.com/bridgewwater/gin-api-swagger-temple/v$v/temp-gin-api-swagger -o temp-gin-api-swagger
# let temp-gin-api-swagger file folder under $PATH
$ chmod +x temp-gin-api-swagger
# see how to use
$ temp-gin-api-swagger -h- this project used to gin api server
- use this template, replace list below
- rename
github.com/bridgewwater/gin-api-swagger-templeto your api package name- rename
bridgewwaterto your project owner name - rename
gin-api-swagger-templeto your project name - rename
34565to your service port
- rename
We welcome community contributions to this project.
Please read Contributor Guide for more information on how to get started.
请阅读有关 贡献者指南 以获取更多如何入门的信息
- config file as viper
- api tracking and version control
by convention-change-log
- embed file
package.jsonbyconvention-change-logkit - middleware
AppVersionwill add api version for Tracking - middleware gin-correlation-id can tracking this server each api request
- embed file
- log by zap and support rotate log file
- access log at different file, and can change by
zap.rotate.AccessFilename - api log file, and can change by config
zap.Api.**
- access log at different file, and can change by
- server status monitor, for help DevOps tracking server status
-
major versionapi support-
api/v1this first version of major api
-
- error management
- basic error generate error by stringer
- http error at different api version use different error management, v1 use by
errdef
- generate swagger doc by swag, and will auto remove at
runmode=release - server handler Exit Signal by
ctrl+corkill -15 [pid]return code 0, for safe exit. - gin unit test case example, support golden data test, you can use
-updatetest flag to update golden data. - local build management by make, also support windows, please
see
make helpProjectRootto install windows need kit. - docker build support, see
make helpDocker, Of course, it is more recommended to use docker-compose to build a local development environment. - github action CI workflow check.
- more perfect test case coverage
- more perfect benchmark case
- see dev.md
- open
Settings->Tools->File Watchers->+->Custom - new
File Watcherasswag api/v1- Files to Watch
- name
swag api/v1 - file type
Go files - scope
Project Files
- name
- Tools to Run on Changes
- Program
$GOPATH$/bin/swag - Arguments
i -g main.go -dir api/v1 --instanceName v1 - Working directory
$ProjectFileDir$
- Program
- Files to Watch

