forked from jinyaoMa/my-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
526 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
build/** linguist-generated | ||
backend/web/certs/** linguist-generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Package docs GENERATED BY SWAG; DO NOT EDIT | ||
// This file was generated by swaggo/swag | ||
package docs | ||
|
||
import "github.com/swaggo/swag" | ||
|
||
const docTemplate = `{ | ||
"schemes": {{ marshal .Schemes }}, | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "{{escape .Description}}", | ||
"title": "{{.Title}}", | ||
"contact": { | ||
"name": "Github Issues", | ||
"url": "https://github.com/jinyaoMa/my-app/issues" | ||
}, | ||
"license": { | ||
"name": "MIT", | ||
"url": "https://github.com/jinyaoMa/my-app/blob/main/LICENSE" | ||
}, | ||
"version": "{{.Version}}" | ||
}, | ||
"host": "{{.Host}}", | ||
"basePath": "{{.BasePath}}", | ||
"paths": {}, | ||
"securityDefinitions": { | ||
"BearerToken": { | ||
"type": "apiKey", | ||
"name": "Authorization", | ||
"in": "header" | ||
} | ||
} | ||
}` | ||
|
||
// SwaggerInfo holds exported Swagger Info so clients can modify it | ||
var SwaggerInfo = &swag.Spec{ | ||
Version: "1.0.0", | ||
Host: "", | ||
BasePath: "/api", | ||
Schemes: []string{}, | ||
Title: "My App (backend/web/router.go)", | ||
Description: "\"My App is a continuously updated personal service collection.\"", | ||
InfoInstanceName: "swagger", | ||
SwaggerTemplate: docTemplate, | ||
} | ||
|
||
func init() { | ||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "\"My App is a continuously updated personal service collection.\"", | ||
"title": "My App (backend/web/router.go)", | ||
"contact": { | ||
"name": "Github Issues", | ||
"url": "https://github.com/jinyaoMa/my-app/issues" | ||
}, | ||
"license": { | ||
"name": "MIT", | ||
"url": "https://github.com/jinyaoMa/my-app/blob/main/LICENSE" | ||
}, | ||
"version": "1.0.0" | ||
}, | ||
"basePath": "/api", | ||
"paths": {}, | ||
"securityDefinitions": { | ||
"BearerToken": { | ||
"type": "apiKey", | ||
"name": "Authorization", | ||
"in": "header" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
basePath: /api | ||
info: | ||
contact: | ||
name: Github Issues | ||
url: https://github.com/jinyaoMa/my-app/issues | ||
description: '"My App is a continuously updated personal service collection."' | ||
license: | ||
name: MIT | ||
url: https://github.com/jinyaoMa/my-app/blob/main/LICENSE | ||
title: My App (backend/web/router.go) | ||
version: 1.0.0 | ||
paths: {} | ||
securityDefinitions: | ||
BearerToken: | ||
in: header | ||
name: Authorization | ||
type: apiKey | ||
swagger: "2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package web | ||
|
||
import ( | ||
_ "my-app/backend/web/docs" | ||
"net/http" | ||
|
||
"github.com/gin-gonic/gin" | ||
swaggerfiles "github.com/swaggo/files" | ||
ginSwagger "github.com/swaggo/gin-swagger" | ||
) | ||
|
||
// @title My App (backend/web/router.go) | ||
// @version 1.0.0 | ||
// @description "My App is a continuously updated personal service collection." | ||
|
||
// @contact.name Github Issues | ||
// @contact.url https://github.com/jinyaoMa/my-app/issues | ||
|
||
// @license.name MIT | ||
// @license.url https://github.com/jinyaoMa/my-app/blob/main/LICENSE | ||
|
||
// @BasePath /api | ||
|
||
// @securityDefinitions.apikey BearerToken | ||
// @in header | ||
// @name Authorization | ||
|
||
func router() *gin.Engine { | ||
r := gin.Default() | ||
|
||
r.GET("/", func(ctx *gin.Context) { | ||
ctx.JSON(http.StatusOK, gin.H{ | ||
"Author": "pong", | ||
}) | ||
}) | ||
|
||
r.GET( | ||
"/swagger/*any", | ||
ginSwagger.WrapHandler( | ||
swaggerfiles.Handler, | ||
ginSwagger.PersistAuthorization(true), | ||
), | ||
) | ||
|
||
return r | ||
} |
Oops, something went wrong.