Skip to main content
Version: fiberi18n_v0.x.x

Swagger

Release Discord Test Security Linter

Swagger middleware for Fiber. The middleware handles Swagger UI.

Table of Contents

Signatures

func New(config ...Config) fiber.Handler

Examples

Import the middleware package that is part of the Fiber web framework

import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/contrib/swagger"
)

Then create a Fiber app with app := fiber.New().

After you initiate your Fiber app, you can use the following possibilities:

Default Config

app.Use(swagger.New(cfg))

Custom Config

cfg := swagger.Config{
BasePath: "/", //swagger ui base path
FilePath: "./docs/swagger.json",
}

app.Use(swagger.New(cfg))