Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flowchartsman/swaggerui
Embedded, self-hosted swagger-ui for go servers
https://github.com/flowchartsman/swaggerui
Last synced: 24 days ago
JSON representation
Embedded, self-hosted swagger-ui for go servers
- Host: GitHub
- URL: https://github.com/flowchartsman/swaggerui
- Owner: flowchartsman
- License: apache-2.0
- Created: 2021-01-18T01:18:08.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-19T14:00:47.000Z (8 months ago)
- Last Synced: 2024-08-03T23:03:37.037Z (4 months ago)
- Language: Go
- Size: 6.95 MB
- Stars: 75
- Watchers: 5
- Forks: 22
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-docs - swaggerui
README
# swaggerui
Embedded, self-hosted [Swagger Ui](https://swagger.io/tools/swagger-ui/) for go serversThis module provides `swaggerui.Handler`, which you can use to serve an embedded copy of [Swagger UI](https://swagger.io/tools/swagger-ui/) as well as an embedded specification for your API.
## Example usage
```go
package mainimport (
_ "embed"
"log"
"net/http""github.com/flowchartsman/swaggerui"
)//go:embed swagger.json
var spec []bytefunc main() {
log.SetFlags(0)
http.Handle("/swagger/", http.StripPrefix("/swagger", swaggerui.Handler(spec)))
log.Println("serving on :8080")
log.Fatal(http.ListenAndServe(":8080", nil))
}
```