23
docs/docs.go
23
docs/docs.go
@@ -9,7 +9,16 @@ const docTemplate = `{
|
|||||||
"info": {
|
"info": {
|
||||||
"description": "{{escape .Description}}",
|
"description": "{{escape .Description}}",
|
||||||
"title": "{{.Title}}",
|
"title": "{{.Title}}",
|
||||||
"contact": {},
|
"termsOfService": "http://swagger.io/terms/",
|
||||||
|
"contact": {
|
||||||
|
"name": "API Support",
|
||||||
|
"url": "http://www.swagger.io/support",
|
||||||
|
"email": "support@swagger.io"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "Apache 2.0",
|
||||||
|
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||||
|
},
|
||||||
"version": "{{.Version}}"
|
"version": "{{.Version}}"
|
||||||
},
|
},
|
||||||
"host": "{{.Host}}",
|
"host": "{{.Host}}",
|
||||||
@@ -1462,12 +1471,12 @@ const docTemplate = `{
|
|||||||
|
|
||||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||||
var SwaggerInfo = &swag.Spec{
|
var SwaggerInfo = &swag.Spec{
|
||||||
Version: "",
|
Version: "1.0",
|
||||||
Host: "",
|
Host: "localhost:8000",
|
||||||
BasePath: "",
|
BasePath: "/api/v1",
|
||||||
Schemes: []string{},
|
Schemes: []string{"http", "https"},
|
||||||
Title: "",
|
Title: "NixCN CMS API",
|
||||||
Description: "",
|
Description: "API Docs based on Gin framework",
|
||||||
InfoInstanceName: "swagger",
|
InfoInstanceName: "swagger",
|
||||||
SwaggerTemplate: docTemplate,
|
SwaggerTemplate: docTemplate,
|
||||||
LeftDelim: "{{",
|
LeftDelim: "{{",
|
||||||
|
|||||||
@@ -1,8 +1,26 @@
|
|||||||
{
|
{
|
||||||
|
"schemes": [
|
||||||
|
"http",
|
||||||
|
"https"
|
||||||
|
],
|
||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
"info": {
|
"info": {
|
||||||
"contact": {}
|
"description": "API Docs based on Gin framework",
|
||||||
|
"title": "NixCN CMS API",
|
||||||
|
"termsOfService": "http://swagger.io/terms/",
|
||||||
|
"contact": {
|
||||||
|
"name": "API Support",
|
||||||
|
"url": "http://www.swagger.io/support",
|
||||||
|
"email": "support@swagger.io"
|
||||||
},
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "Apache 2.0",
|
||||||
|
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||||
|
},
|
||||||
|
"version": "1.0"
|
||||||
|
},
|
||||||
|
"host": "localhost:8000",
|
||||||
|
"basePath": "/api/v1",
|
||||||
"paths": {
|
"paths": {
|
||||||
"/auth/exchange": {
|
"/auth/exchange": {
|
||||||
"post": {
|
"post": {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
basePath: /api/v1
|
||||||
definitions:
|
definitions:
|
||||||
data.User:
|
data.User:
|
||||||
properties:
|
properties:
|
||||||
@@ -154,8 +155,19 @@ definitions:
|
|||||||
status:
|
status:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
host: localhost:8000
|
||||||
info:
|
info:
|
||||||
contact: {}
|
contact:
|
||||||
|
email: support@swagger.io
|
||||||
|
name: API Support
|
||||||
|
url: http://www.swagger.io/support
|
||||||
|
description: API Docs based on Gin framework
|
||||||
|
license:
|
||||||
|
name: Apache 2.0
|
||||||
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
termsOfService: http://swagger.io/terms/
|
||||||
|
title: NixCN CMS API
|
||||||
|
version: "1.0"
|
||||||
paths:
|
paths:
|
||||||
/auth/exchange:
|
/auth/exchange:
|
||||||
post:
|
post:
|
||||||
@@ -823,4 +835,7 @@ paths:
|
|||||||
summary: Update User Information
|
summary: Update User Information
|
||||||
tags:
|
tags:
|
||||||
- User
|
- User
|
||||||
|
schemes:
|
||||||
|
- http
|
||||||
|
- https
|
||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
|
|||||||
@@ -2,4 +2,5 @@ package main
|
|||||||
|
|
||||||
//go:generate go run ./cmd/gen_exception/main.go
|
//go:generate go run ./cmd/gen_exception/main.go
|
||||||
|
|
||||||
//go:generate swag init
|
//go:generate swag fmt
|
||||||
|
//go:generate swag init -g server/server.go
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -19,7 +19,6 @@ require (
|
|||||||
github.com/spf13/viper v1.21.0
|
github.com/spf13/viper v1.21.0
|
||||||
github.com/swaggo/files v1.0.1
|
github.com/swaggo/files v1.0.1
|
||||||
github.com/swaggo/gin-swagger v1.6.1
|
github.com/swaggo/gin-swagger v1.6.1
|
||||||
github.com/swaggo/swag v1.16.6
|
|
||||||
go.opentelemetry.io/contrib/bridges/otelslog v0.14.0
|
go.opentelemetry.io/contrib/bridges/otelslog v0.14.0
|
||||||
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.64.0
|
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.64.0
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0
|
||||||
@@ -113,6 +112,7 @@ require (
|
|||||||
github.com/spf13/cast v1.10.0 // indirect
|
github.com/spf13/cast v1.10.0 // indirect
|
||||||
github.com/spf13/pflag v1.0.10 // indirect
|
github.com/spf13/pflag v1.0.10 // indirect
|
||||||
github.com/subosito/gotenv v1.6.0 // indirect
|
github.com/subosito/gotenv v1.6.0 // indirect
|
||||||
|
github.com/swaggo/swag v1.16.6 // indirect
|
||||||
github.com/tjfoc/gmsm v1.4.1 // indirect
|
github.com/tjfoc/gmsm v1.4.1 // indirect
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
github.com/ugorji/go/codec v1.3.1 // indirect
|
github.com/ugorji/go/codec v1.3.1 // indirect
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import (
|
|||||||
// @contact.email support@swagger.io
|
// @contact.email support@swagger.io
|
||||||
// @license.name Apache 2.0
|
// @license.name Apache 2.0
|
||||||
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
// @host localhost:8080
|
// @host localhost:8000
|
||||||
// @BasePath /api/v1
|
// @BasePath /api/v1
|
||||||
// @schemes http https
|
// @schemes http https
|
||||||
func Start(ctx context.Context) {
|
func Start(ctx context.Context) {
|
||||||
@@ -39,10 +39,11 @@ func Start(ctx context.Context) {
|
|||||||
r := gin.New()
|
r := gin.New()
|
||||||
r.Use(otelgin.Middleware(viper.GetString("server.service_name")))
|
r.Use(otelgin.Middleware(viper.GetString("server.service_name")))
|
||||||
r.Use(middleware.GinLogger())
|
r.Use(middleware.GinLogger())
|
||||||
r.Use(gin.Recovery())
|
|
||||||
|
|
||||||
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||||
|
|
||||||
|
r.Use(gin.Recovery())
|
||||||
|
|
||||||
api.Handler(r.Group("/api/v1"))
|
api.Handler(r.Group("/api/v1"))
|
||||||
|
|
||||||
// Start http server
|
// Start http server
|
||||||
|
|||||||
Reference in New Issue
Block a user