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: 3 months 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 (7 months ago)
- Last Synced: 2024-06-18T15:34:33.987Z (5 months ago)
- Language: Go
- Size: 6.95 MB
- Stars: 72
- Watchers: 5
- Forks: 21
- 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))
}
```