All Projects → arsmn → fiber-swagger

arsmn / fiber-swagger

Licence: MIT license
fiber middleware to automatically generate RESTful API documentation with Swagger 2.0.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to fiber-swagger

Sylar
C++高性能分布式服务器框架,webserver,websocket server,自定义tcp_server(包含日志模块,配置模块,线程模块,协程模块,协程调度模块,io协程调度模块,hook模块,socket模块,bytearray序列化,http模块,TcpServer模块,Websocket模块,Https模块等, Smtp邮件模块, MySQL, SQLite3, ORM,Redis,Zookeeper)
Stars: ✭ 895 (+276.05%)
Mutual labels:  fiber
Lightio
LightIO is a userland implemented green thread library for ruby
Stars: ✭ 165 (-30.67%)
Mutual labels:  fiber
storage
📦 Premade storage drivers for 🚀 Fiber
Stars: ✭ 156 (-34.45%)
Mutual labels:  fiber
Boilerplate
🚧 Boilerplate for 🚀 Fiber
Stars: ✭ 73 (-69.33%)
Mutual labels:  fiber
Fibry
The first Java Actor System supporting fibers from Project Loom
Stars: ✭ 146 (-38.66%)
Mutual labels:  fiber
React Three Fiber
🇨🇭 A React renderer for Three.js
Stars: ✭ 16,097 (+6663.45%)
Mutual labels:  fiber
Recipes
📁 Examples for 🚀 Fiber
Stars: ✭ 691 (+190.34%)
Mutual labels:  fiber
utils
⚡ A collection of common functions but with better performance, less allocations and less dependencies created for Fiber.
Stars: ✭ 21 (-91.18%)
Mutual labels:  fiber
Minicoro
Single header asymmetric stackful cross-platform coroutine library in pure C.
Stars: ✭ 164 (-31.09%)
Mutual labels:  fiber
Just React
「React技术揭秘」 一本自顶向下的React源码分析书
Stars: ✭ 3,897 (+1537.39%)
Mutual labels:  fiber
Docs
📚 Documentation for 🚀 Fiber
Stars: ✭ 121 (-49.16%)
Mutual labels:  fiber
Fiber Ext
stackful-coroutines for PHP
Stars: ✭ 142 (-40.34%)
Mutual labels:  fiber
React Conf 17 Videos
Find that one presentation you missed!
Stars: ✭ 182 (-23.53%)
Mutual labels:  fiber
Websocket
🧬 WebSocket middleware for Fiber
Stars: ✭ 59 (-75.21%)
Mutual labels:  fiber
ikisocket
🧬 WebSocket wrapper with event management for Fiber https://github.com/gofiber/fiber. Based on Fiber WebSocket and inspired by Socket.io
Stars: ✭ 92 (-61.34%)
Mutual labels:  fiber
Rxjavafiberinterop
Library for interoperation between RxJava 3 and Project Loom's Fibers.
Stars: ✭ 19 (-92.02%)
Mutual labels:  fiber
Fiber
⚡️ Express inspired web framework written in Go
Stars: ✭ 17,334 (+7183.19%)
Mutual labels:  fiber
keyauth
🧬 Key Authentication for Fiber
Stars: ✭ 58 (-75.63%)
Mutual labels:  fiber
YACLib
Yet Another Concurrency Library
Stars: ✭ 193 (-18.91%)
Mutual labels:  fiber
Fre
👻 Tiny Footprint Concurrent UI library for Fiber.
Stars: ✭ 3,195 (+1242.44%)
Mutual labels:  fiber

HAS BEEN MOVED TO https://github.com/gofiber/swagger

fiber-swagger

fiber middleware to automatically generate RESTful API documentation with Swagger 2.0.

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 -u 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
  1. Download fiber-swagger by using:
$ go get -u github.com/arsmn/fiber-swagger/v2

And import following in your code:

import "github.com/arsmn/fiber-swagger/v2" // fiber-swagger middleware

Canonical example:

package main

import (
	swagger "github.com/arsmn/fiber-swagger/v2"
	"github.com/gofiber/fiber/v2"

	// docs are generated by Swag CLI, you have to import them.
	// replace with your own docs folder, usually "github.com/username/reponame/docs"
	_ "github.com/arsmn/fiber-swagger/v2/example/docs"
)

// @title Fiber Example API
// @version 1.0
// @description This is a sample swagger for Fiber
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.email [email protected]
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host localhost:8080
// @BasePath /
func main() {
	app := fiber.New()

	app.Get("/swagger/*", swagger.HandlerDefault) // default

	app.Get("/swagger/*", swagger.New(swagger.Config{ // custom
		URL: "http://example.com/doc.json",
		DeepLinking: false,
		// Expand ("list") or Collapse ("none") tag groups by default
		DocExpansion: "none",
		// Prefill OAuth ClientId on Authorize popup
		OAuth: &swagger.OAuthConfig{
			AppName:  "OAuth Provider",
			ClientId: "21bb4edc-05a7-4afc-86f1-2e151e4ba6e2",
		},
		// Ability to change OAuth2 redirect uri location
		OAuth2RedirectUrl: "http://localhost:8080/swagger/oauth2-redirect.html",
	}))

	app.Listen(":8080")
}
  1. Run it, and browser to http://localhost:8080/swagger, you can see Swagger 2.0 Api documents.

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].