swaggerui

package module
v0.0.0-...-8c4d7ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 3 Imported by: 1

README

Update Swagger UI

Download the latest Swagger UI dist from the official GitHub Releases page. Copy and overwrite the dist folder in swagger-ui module. Replace the url inside the swagger-initializer.js file by ./swagger_spec.

Usage

//go:embed api.yaml
var apiSpec []byte

func main() {
	http.Handle("/swagger-ui/", http.StripPrefix("/swagger-ui", swaggerui.Handler(apiSpec)))
	log.Fatal(http.ListenAndServe(":8080", nil))
}

Reference

https://medium.com/@ribice/serve-swaggerui-within-your-golang-application-5486748a5ed4

https://github.com/flowchartsman/swaggerui

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(spec []byte) http.Handler

Handler returns a handler that will serve a self-hosted Swagger UI with given spec

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL