https://github.com/linxlib/swagger_inject
https://github.com/linxlib/swagger_inject
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/linxlib/swagger_inject
- Owner: linxlib
- License: mit
- Created: 2023-01-30T01:21:53.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-23T07:32:05.000Z (over 3 years ago)
- Last Synced: 2024-06-20T06:33:26.314Z (almost 2 years ago)
- Language: CSS
- Size: 1.01 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Swgger Inject
embed swagger ui resources
# usage
assume you will access your swagger ui from `/swagger/index.html`
just serve your `swagger.json` at /swagger.json
see `swagger/js/swagger-initializer.js` for details
### gin example
```go
package main
import (
"github.com/gin-gonic/gin"
"github.com/linxlib/swagger_inject"
)
func main() {
r := gin.Default()
r.GET("/swagger.json",func(c *gin.Context) {
// write your swagger.json to response body
})
r.GET("/swagger/*any",func(c *gin.Context){
c.FileFromFS(c.Request.URL.Path, http.FS(swagger_inject.FS))
})
r.Run(":8080")
}
```