Monitor
Monitor middleware for Fiber that reports server metrics, inspired by express-status-monitor​
​
⚠
Warning: Monitor is still in beta, API might change in the future!

Table of Contents

Signatures

1
func New() fiber.Handler
Copied!

Examples

Import the middleware package and assign it to a route.
1
package main
2
​
3
import (
4
"log"
5
​
6
"github.com/gofiber/fiber/v2"
7
"github.com/gofiber/fiber/v2/middleware/monitor"
8
)
9
​
10
func main() {
11
app := fiber.New()
12
13
app.Get("/dashboard", monitor.New())
14
15
log.Fatal(app.Listen(":3000"))
16
}
Copied!

Config

1
// Config defines the config for middleware.
2
type Config struct {
3
// To disable serving HTML, you can make true this option.
4
//
5
// Optional. Default: false
6
APIOnly bool
7
8
// Next defines a function to skip this middleware when returned true.
9
//
10
// Optional. Default: nil
11
Next func(c *fiber.Ctx) bool
12
}
Copied!

Default Config

1
var ConfigDefault = Config{
2
APIOnly: false,
3
Next: nil,
4
}
Copied!
Last modified 5mo ago