Embedded, self-hosted swagger-ui for go servers

Overview

swaggerui

Embedded, self-hosted Swagger Ui for go servers

This module provides swaggerui.Handler, which you can use to serve an embedded copy of Swagger UI as well as an embedded specification for your API.

NOTE

This module depends on the embed package provided by the upcoming go 1.16 release, so it depends on having at least go 1.16 and, until that release lands, this project should be considered experimental. Once 1.16 lands, the repository will be version tagged to the latest major release of Swagger UI, using the included generate.go to keep up with future releases as necessary for tracking changes.

Example usage

package main

import (
	_ "embed"
	"log"
	"net/http"

	"github.com/flowchartsman/swaggerui"
)

//go:embed swagger.json
var spec []byte

func main() {
	log.SetFlags(0)
	http.Handle("/swagger/", http.StripPrefix("/swagger", swaggerui.Handler(spec, swaggerui.SpecTypeJSON)))
	log.Println("serving on :8080")
	log.Fatal(http.ListenAndServe(":8080", nil))
}
You might also like...
The fastest way to create self-hosted exit-servers
The fastest way to create self-hosted exit-servers

inletsctl - the fastest way to create self-hosted exit-servers inletsctl automates the task of creating an exit-server (tunnel server) on public cloud

Swagger + Gin = SwaGin, a web framework based on Gin and Swagger
Swagger + Gin = SwaGin, a web framework based on Gin and Swagger

Swagger + Gin = SwaGin Introduction SwaGin is a web framework based on Gin and Swagger, which wraps Gin and provides built-in swagger api docs and req

Swagger + Gin = SwaGin, a web framework based on Gin and Swagger
Swagger + Gin = SwaGin, a web framework based on Gin and Swagger

Swagger + Gin = SwaGin Introduction SwaGin is a web framework based on Gin and Swagger, which wraps Gin and provides built-in swagger api docs and req

Swagger-go-chi - Generate a go-chi server from swagger

swagger-go-chi Install go install github.com/cugu/[email protected] Run swagge

Swagger builder and input validation for Go servers
Swagger builder and input validation for Go servers

crud A Swagger/OpenAPI builder and validation library for building HTTP/REST APIs. Heavily inspired by hapi and the hapi-swagger projects. No addition

Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.

Selenoid Selenoid is a powerful implementation of Selenium hub using Docker containers to launch browsers. Features One-command Installation Start bro

Git with a cup of tea, painless self-hosted git service
Git with a cup of tea, painless self-hosted git service

Gitea - Git with a cup of tea View the chinese version of this document Purpose The goal of this project is to make the easiest, fastest, and most pai

Git with a cup of tea, painless self-hosted git service
Git with a cup of tea, painless self-hosted git service

Gitea - Git with a cup of tea View the chinese version of this document Purpose The goal of this project is to make the easiest, fastest, and most pai

Remark42 is a self-hosted, lightweight, and simple comment engine
Remark42 is a self-hosted, lightweight, and simple comment engine

Remark42 is a self-hosted, lightweight, and simple (yet functional) comment engine, which doesn't spy on users. It can be embedded into blogs, articles or any other place where readers add comments.

Distributed, lock-free, self-hosted health checks and status pages
Distributed, lock-free, self-hosted health checks and status pages

Checkup is distributed, lock-free, self-hosted health checks and status pages, written in Go. It features an elegant, minimalistic CLI and an idiomati

EggContractor is a self-hosted contract monitoring web app + CLI client for Egg

EggContractor is a self-hosted contract monitoring web app + CLI client for Egg, Inc.. It allows you to easily monitor all your contract progress, as well as peeking into prospective coops you may want to join.

TeslaMateApi is a RESTful API to get data collected by self-hosted data logger TeslaMate in JSON

TeslaMateApi is a RESTful API to get data collected by self-hosted data logger TeslaMate in JSON.

✒ A self-hosted, cross-platform service to sign iOS apps using any CI as a builder
✒ A self-hosted, cross-platform service to sign iOS apps using any CI as a builder

iOS Signer Service A self-hosted, cross-platform service to sign iOS apps using any CI as a builder Introduction There are many reasons to install app

Self hosted live chat server written in Go

goch is a self-hosted live-chat server written in Go. It allows you to run a live-chat software on your own infrastructure. You can create multip

High performance, self-hosted newsletter and mailing list manager with a modern dashboard. Single binary app.
High performance, self-hosted newsletter and mailing list manager with a modern dashboard. Single binary app.

listmonk is a standalone, self-hosted, newsletter and mailing list manager. It is fast, feature-rich, and packed into a single binary. It uses a Postg

📕 twtxt is a Self-Hosted, Twitter™-like Decentralised microBlogging platform. No ads, no tracking, your content, your data!
📕 twtxt is a Self-Hosted, Twitter™-like Decentralised microBlogging platform. No ads, no tracking, your content, your data!

twtxt 📕 twtxt is a Self-Hosted, Twitter™-like Decentralised micro-Blogging platform. No ads, no tracking, your content, your data! Technically twtxt

Gogs is a painless self-hosted Git service
Gogs is a painless self-hosted Git service

Gogs - A painless self-hosted Git service 简体中文 🔮 Vision The Gogs (/gɑgz/) project aims to build a simple, stable and extensible self-hosted Git servi

Git with a cup of tea, painless self-hosted git service
Git with a cup of tea, painless self-hosted git service

Gitea - Git with a cup of tea View the chinese version of this document Purpose The goal of this project is to make the easiest, fastest, and most pai

Universal code search (self-hosted)
Universal code search (self-hosted)

Sourcegraph OSS edition is a fast, open-source, fully-featured code search and navigation engine. Enterprise editions are available. Features Fast glo

Comments
  • chi-router doesnt seem to work well with swaggerui

    chi-router doesnt seem to work well with swaggerui

    Issue

    it looks like when using swaggerui with go-chi router module, the http request fails to find the embedded CSS files and resources.

    Screen Shot 2022-01-31 at 9 47 25

    Snippet

    import github.com/go-chi/chi
    r := chi.NewRouter()
    r.Handle("/swagger/", http.StripPrefix("/swagger", swaggerui.Handler(spec)))
    

    Additional Info

    go 1.17 github.com/go-chi/chi/v5 v5.0.7

    opened by talbSE 6
  • github actions to publish changes to swagger-ui to a bleed branch.

    github actions to publish changes to swagger-ui to a bleed branch.

    The go generate code has been adapted for the current version of swagger-ui, which more or less amounted to pointing it at a different file, so it should remain stable enough to run against new releases unless they decide to switch something around again. There's no guarantee it will work every time, but for those who want to try it out, it would be better to have some kind of job to do the chore stuff for me and allow people to use newer versions more quickly.

    opened by flowchartsman 0
  • Allow UI Customization

    Allow UI Customization

    It would be nice if the user could customize certain aspects of their UI, either via CSS or turning on/off certain swagger-ui features. Of course, the more things that get templatized means the more potentially fragile the generate code to keep the static files up to date becomes, so this will need to be done carefully, and each one will probably need to get hooked into the CI system to surface any potentially-breaking changes from upstream.

    • [ ] Prebuild some new layouts and themes
    • [ ] Templatize swagger-initializer.js rather than swapping out the values (plugins/layouts)
    • [ ] Templatize .css
    enhancement 
    opened by flowchartsman 0
Owner
Andy Walker
Andy Walker
Self hosted search engine for data leaks and password dumps

Self hosted search engine for data leaks and password dumps. Upload and parse multiple files, then quickly search through all stored items with the power of Elasticsearch.

Davide Pataracchia 22 Aug 2, 2021
Listmonk - a standalone, self-hosted, newsletter and mailing list manager

listmonk is a standalone, self-hosted, newsletter and mailing list manager. It is fast, feature-rich, and packed into a single binary. It uses a Postg

null 0 Jan 13, 2022
Swagger 2.0 implementation for go

Swagger 2.0 This package contains a golang implementation of Swagger 2.0 (aka OpenAPI 2.0): it knows how to serialize and deserialize swagger specific

Go Swagger 8.2k Dec 8, 2022
F' - A flight software and embedded systems framework

F´ (F Prime) is a component-driven framework that enables rapid development and deployment of spaceflight and other embedded software applications.

NASA 9.2k Dec 4, 2022
A BPMN engine, meant to be embedded in Go applications with minim hurdles, and a pleasant developer experience using it.

A BPMN engine, meant to be embedded in Go applications with minim hurdles, and a pleasant developer experience using it. This approach can increase transparency for non-developers.

Martin W. Kirst 83 Nov 30, 2022
Embedded javascript server-side renderer for Golang

v8ssr Embedded javascript server-side renderer for Golang. Useful for static server-side rendering. This does not attempt to polyfill node or browser

null 2 Aug 27, 2022
Host yo' self from your browser, your phone, your toaster.

A hosting service from the browser, because why not. Try it at hostyoself.com. See it in action Here's an example where I use hostyoself.com to host i

Zack 1.7k Nov 29, 2022
Enable your Golang applications to self update with S3

s3update Enable your Golang applications to self update with S3. Requires Go 1.8+ This package enables our internal tools to be updated when new commi

Heetch 103 Jul 20, 2022
A framework for constructing self-spreading binaries

A framework that aids in creation of self-spreading software Requirements go get -u github.com/redcode-labs/Coldfire go get -u github.com/yelinaung/go

Red Code Labs 926 Dec 1, 2022
GoatCounter is an open source web analytics platform available as a hosted service or self-hosted app

GoatCounter is an open source web analytics platform available as a hosted service (free for non-commercial use) or self-hosted app. It aims to offer easy to use and meaningful privacy-friendly web analytics as an alternative to Google Analytics or Matomo.

zgoat 2.9k Nov 28, 2022