Skip to content

bridgewwater/gin-api-swagger-temple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ci

go mod version GoDoc goreportcard

GitHub license GitHub latest SemVer tag) GitHub release)

cli tools to init project fast

$ 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

for what

  • this project used to gin api server
  • use this template, replace list below
  • rename github.com/bridgewwater/gin-api-swagger-temple to your api package name
    • rename bridgewwater to your project owner name
    • rename gin-api-swagger-temple to your project name
    • rename 34565 to your service port

Contributing

Contributor Covenant GitHub contributors

We welcome community contributions to this project.

Please read Contributor Guide for more information on how to get started.

请阅读有关 贡献者指南 以获取更多如何入门的信息

Features

  • config file as viper
  • api tracking and version control by convention-change-log
    • embed file package.json by convention-change-log kit
    • middleware AppVersion will add api version for Tracking
    • middleware gin-correlation-id can tracking this server each api request
  • 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.**
  • server status monitor, for help DevOps tracking server status
  • major version api support
    • api/v1 this 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+c or kill -15 [pid] return code 0, for safe exit.
  • gin unit test case example, support golden data test, you can use -update test flag to update golden data.
  • local build management by make, also support windows, please see make helpProjectRoot to 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

dev

development skills

goland auto generate swagger doc

  • open Settings -> Tools -> File Watchers -> + -> Custom
  • new File Watcher as swag api/v1
    • Files to Watch
      • name swag api/v1
      • file type Go files
      • scope Project Files
    • Tools to Run on Changes
      • Program $GOPATH$/bin/swag
      • Arguments i -g main.go -dir api/v1 --instanceName v1
      • Working directory $ProjectFileDir$

About

gin API swagger temple

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •