Skip to content

jsonCarmock/swgui

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swagger UI

GoDevDoc

Package swgui (Swagger UI) provides HTTP handler to serve Swagger UI. All assets are embedded in Go source code, so just build and run.

Static assets for v3 are built from Swagger UI v3.25.4.

CDN-based v3cdn uses Swagger UI v3.24.2.

How to use

package main

import (
    "net/http"

    "github.com/swaggest/swgui/v3"
)

func main() {
    http.Handle("/", v3.NewHandler("My API", "/swagger.json", "/"))
    http.ListenAndServe(":8080", nil)
}

Use CDN for assets

In order to reduce binary size you can import github.com/swaggest/swgui/v3cdn to use CDN hosted assets.

Also you can use swguicdn build tag to enable CDN mode for github.com/swaggest/swgui/v3 import.

Be aware that CDN mode may be considered inappropriate for security or networking reasons.

Run as standalone server

Install swgui-server

go get github.com/swaggest/swgui/...

Start server

swgui-server -port 8080

About

Embedded Swagger UI for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 93.7%
  • CSS 5.1%
  • Other 1.2%