Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 877 Bytes

README.md

File metadata and controls

31 lines (21 loc) · 877 Bytes

Go Swagger UI

Build Status Documentation

This package provides a simple handler for rendering the Swagger UI in a Go application

Example

package main

import (
	"net/http"

	"github.com/mark-adams/go-swagger-ui"
)

func main() {
	// Swagger UI using the latest JS / CSS from unpkg and loading the spec from /swagger.json
	http.Handle("/docs", swaggerui.Handler())

	// Swagger UI using a custom title, spec URL, and version of Swagger UI
	http.Handle("/docs-petstore", swaggerui.CustomHandler(
		"API Documentation", "http://petstore.swagger.io/v2/swagger.json", "latest",
	))

	http.ListenAndServe(":8080", nil)
}