Discover Packages
github.com/bridgewwater/gin-api-swagger-temple
package
module
Version:
v1.1.3
Opens a new window with list of versions in this module.
Published: Jan 19, 2025
License: Apache-2.0, MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
$ v=1.1.3; 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
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$
Expand ▾
Collapse ▴
Documentation
¶
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.