改进 swag go
This commit is contained in:
parent
8231060f30
commit
57e57e5028
3
Makefile
3
Makefile
@ -6,4 +6,5 @@ grpc-web:
|
||||
grpcwebproxy --backend_addr=localhost:8081 --run_http_server --run_tls_server=false --server_http_debug_port 18081 --allow_all_origins --server_bind_address 127.0.0.1
|
||||
install-deps:
|
||||
go install github.com/swaggo/swag/cmd/swag@latest
|
||||
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
|
||||
swag:
|
||||
swag init -g internal/routes/router.go
|
@ -7,6 +7,27 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @title Swagger Example API
|
||||
// @version 1.0
|
||||
// @description This is a sample server celler server.
|
||||
// @termsOfService http://swagger.io/terms/
|
||||
|
||||
// @contact.name API Support
|
||||
// @contact.url http://www.swagger.io/support
|
||||
// @contact.email support@swagger.io
|
||||
|
||||
// @license.name Apache 2.0
|
||||
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
// @host localhost:8080
|
||||
// @BasePath /api/v1
|
||||
|
||||
// @securityDefinitions.basic BasicAuth
|
||||
|
||||
// @securityDefinitions.apikey ApiKeyAuth
|
||||
// @in header
|
||||
// @name Authorization
|
||||
// @description Description for what is this security definition being used
|
||||
func InitApiRoutes() {
|
||||
var router = *providers.MustGet[gin.Engine]()
|
||||
|
||||
|
11
main.go
11
main.go
@ -5,6 +5,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"framework_v2/internal/cmd"
|
||||
"framework_v2/internal/providers"
|
||||
"io/fs"
|
||||
"os"
|
||||
"os/exec"
|
||||
@ -17,9 +18,13 @@ const frameworkModuleName = "framework_v2"
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if len(os.Args) == 2 && os.Args[1] == "setup" {
|
||||
setup()
|
||||
return
|
||||
var config = providers.MustGet[providers.GlobalConfig]()
|
||||
|
||||
if config.DebugMode.Enable {
|
||||
if len(os.Args) == 2 && os.Args[1] == "setup" {
|
||||
setup()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
cmd.Execute()
|
||||
|
Loading…
Reference in New Issue
Block a user