0x01001011 / fiber-health-check

A health check middleware for fiber web framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fiber-health-check 🩺 Middleware

codecov License GoDoc Go Report Card

🩺Fiber-health-check middleware support health-check for Fiber⚡️ framework.

Signatures

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

How to use

Frist import the midllware from Github,

go get -u github.com/gofiber/v2
go get -u github.com/aschenmaker/fiber-health-check

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

Default Config

app.Use(healthcheck.New())

Custom Config

app.Use(healthcheck.New(
	HeaderName:   "X-Custom-Header",
	HeaderValue:  "customValue",
	ResponseCode: http.StatusTeapot,
	ResponseText: "teapot",
))

Config

// Config defines the config for middleware
type Config struct {
    // HeaderName defines the health check header key
    //
    // Optional. Default: "X-Health-Check"
    HeaderName   string
    // HeaderValue defines the health check header val
    //
    // Optional. Default: "1"
    HeaderValue  string
    // ResponseCode defines the health check response code
    //
    // Optional. Default: http.StatusOK
    ResponseCode int
    // ResponseText defines the health check response description
    //
    // Optional. Default: "ok"
    ResponseText string
}

About

A health check middleware for fiber web framework.

License:MIT License


Languages

Language:Go 100.0%