All Projects → swaggo → Http Swagger

swaggo / Http Swagger

Licence: mit
Default net/http wrapper to automatically generate RESTful API documentation with Swagger 2.0.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Http Swagger

Echo Swagger
echo middleware to automatically generate RESTful API documentation with Swagger 2.0.
Stars: ✭ 314 (+89.16%)
Mutual labels:  swagger2, middleware
Redux Arc
A declarative way to make request with redux actions
Stars: ✭ 162 (-2.41%)
Mutual labels:  middleware
Has Parameters
A trait that allows you to pass arguments to Laravel middleware in a more PHP'ish way.
Stars: ✭ 149 (-10.24%)
Mutual labels:  middleware
Koa Hbs
Handlebars templates for Koa.js
Stars: ✭ 156 (-6.02%)
Mutual labels:  middleware
Strapi Middleware Cache
🔌 A cache middleware for https://strapi.io
Stars: ✭ 146 (-12.05%)
Mutual labels:  middleware
Gaea
Gaea is a mysql proxy, it's developed by xiaomi b2c-dev team.
Stars: ✭ 2,123 (+1178.92%)
Mutual labels:  middleware
Okhelper Service
OK帮 云进销存 (SpringBoot Restful 全家桶)
Stars: ✭ 146 (-12.05%)
Mutual labels:  swagger2
Preston
Serve Mongoose models on a RESTful API.
Stars: ✭ 165 (-0.6%)
Mutual labels:  middleware
Next Session
Simple promise-based session middleware for Next.js, micro, Express, and more
Stars: ✭ 161 (-3.01%)
Mutual labels:  middleware
React Model
The next generation state management library for React
Stars: ✭ 153 (-7.83%)
Mutual labels:  middleware
Negroni Authz
negroni-authz is an authorization middleware for Negroni
Stars: ✭ 152 (-8.43%)
Mutual labels:  middleware
Redux Catch
Error catcher middleware for Redux reducers and sync middlewares
Stars: ✭ 150 (-9.64%)
Mutual labels:  middleware
Gramps Express
NOTE: The GrAMPS core has moved to https://github.com/gramps-graphql/gramps
Stars: ✭ 161 (-3.01%)
Mutual labels:  middleware
Request Migrations
HTTP Request Migrations for API Versioning like Stripe
Stars: ✭ 149 (-10.24%)
Mutual labels:  middleware
Flusk
Boilerplate API on how to structure big Flask applications (includes SQLAlchemy, Docker, nginx)
Stars: ✭ 165 (-0.6%)
Mutual labels:  middleware
Slack Api Specs
Open API specifications for platform products by Slack
Stars: ✭ 148 (-10.84%)
Mutual labels:  swagger2
Plasma
universal server push middleware by using gRPC stream and Server Sent Events(SSE)
Stars: ✭ 151 (-9.04%)
Mutual labels:  middleware
Ginrpc
gin auto binding,grpc, and annotated route,gin 注解路由, grpc,自动参数绑定工具
Stars: ✭ 157 (-5.42%)
Mutual labels:  middleware
Laravel Rate Limited Job Middleware
A job middleware to rate limit jobs
Stars: ✭ 166 (+0%)
Mutual labels:  middleware
Webgo
A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).
Stars: ✭ 165 (-0.6%)
Mutual labels:  middleware

http-swagger

Default net/http wrapper to automatically generate RESTful API documentation with Swagger 2.0.

Travis branch Codecov branch Go Report Card GoDoc

Usage

Start using it

  1. Add comments to your API source code, See Declarative Comments Format.
  2. Download Swag for Go by using:
$ go get github.com/swaggo/swag/cmd/swag
  1. Run the Swag in your Go project root folder which contains main.go file, Swag will parse comments and generate required files(docs folder and docs/doc.go).
$ swag init

4.Download http-swagger by using:

$ go get -u github.com/swaggo/http-swagger

And import following in your code:

import "github.com/swaggo/http-swagger" // http-swagger middleware

Canonical example:

package main

import (
	"net/http"

	"github.com/go-chi/chi"
	"github.com/swaggo/http-swagger"
	_ "github.com/swaggo/http-swagger/example/go-chi/docs" // docs is generated by Swag CLI, you have to import it.
)

// @title Swagger Example API
// @version 1.0
// @description This is a sample server Petstore server.
// @termsOfService http://swagger.io/terms/

// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email [email protected]

// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html

// @host petstore.swagger.io
// @BasePath /v2
func main() {
	r := chi.NewRouter()

	r.Get("/swagger/*", httpSwagger.Handler(
		httpSwagger.URL("http://localhost:1323/swagger/doc.json"), //The url pointing to API definition"
	))

	http.ListenAndServe(":1323", r)
}

  1. Run it, and browser to http://localhost:1323/swagger/index.html, you can see Swagger 2.0 Api documents.

swagger_index.html

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].