Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aschenmaker/fiber-health-check
A health check middleware for fiber web framework.
https://github.com/aschenmaker/fiber-health-check
Last synced: 3 months ago
JSON representation
A health check middleware for fiber web framework.
- Host: GitHub
- URL: https://github.com/aschenmaker/fiber-health-check
- Owner: aschenmaker
- License: mit
- Created: 2021-06-01T16:55:27.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-06-03T14:52:34.000Z (over 3 years ago)
- Last Synced: 2024-06-19T16:34:38.540Z (5 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-fiber - aschenmaker/fiber-health-check - Health-check middleware support health-check for Fiber️ framework. (⚙️ Middlewares / 🌱 Third Party)
README
# Fiber-health-check 🩺 Middleware
[![codecov](https://codecov.io/gh/aschenmaker/fiber-health-check/branch/master/graph/badge.svg?token=IA1S3HB9TE)](https://codecov.io/gh/aschenmaker/fiber-health-check)
[![License](https://img.shields.io/github/license/aschenmaker/fiber-health-check)](LICENSE)
[![GoDoc](https://pkg.go.dev/badge/github.com/aschenmaker/fiber-health-check)](https://pkg.go.dev/github.com/aschenmaker/fiber-health-check)
[![Go Report Card](https://goreportcard.com/badge/github.com/aschenmaker/fiber-health-check)](https://goreportcard.com/report/github.com/aschenmaker/fiber-health-check)🩺Fiber-health-check middleware support health-check for [Fiber](https://github.com/gofiber/fiber)⚡️ framework.
## Signatures
```go
func New(config ...Config) fiber.Handler
```## How to use
Frist import the midllware from Github,
```shell
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
```go
app.Use(healthcheck.New())
```
## Custom Config
```go
app.Use(healthcheck.New(
HeaderName: "X-Custom-Header",
HeaderValue: "customValue",
ResponseCode: http.StatusTeapot,
ResponseText: "teapot",
))
```
## Config
```go
// 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
}
```