Skip to content

Kotodian/go-redoc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-redoc

GoDoc Go Report Card

go-redoc is an embedded OpenAPI documentation ui for Go using ReDoc and 1.16's embed, with middleware implementations for: net/http, gin and echo. The template is based on the ReDoc's bundle template with the script already placed in the html instead of depending on a cdn.

Usage

import "github.com/Kotodian/go-redoc"

...

doc := redoc.Redoc{
    Title:       "Example API",
    Description: "Example API Description",
    SpecFile:    "./openapi.json",
    SpecPath:    "/openapi.json",
    DocsPath:    "/docs",
}
  • net/http
import (
	"net/http"
	"github.com/Kotodian/go-redoc"
)

...

http.ListenAndServe(address, doc.Handler())
  • gin
import (
	"github.com/gin-gonic/gin"
	"github.com/Kotodian/go-redoc"
	ginredoc "github.com/Kotodian/go-redoc/gin"
)

...

r := gin.New()
r.Use(ginredoc.New(doc))
  • echo
import (
	"github.com/labstack/echo/v4"
	"github.com/Kotodian/go-redoc"
	echoredoc "github.com/Kotodian/go-redoc/echo"
)

...

r := echo.New()
r.Use(echoredoc.New(doc))

See examples

About

go-redoc is an embedded OpenAPI/Swagger documentation ui for Go using ReDoc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 85.1%
  • HTML 10.2%
  • Makefile 4.7%