mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-22 09:12:59 +00:00
* Add disable html support to monitor middleware. * Change field. * Update README.md * Update middleware/monitor/config.go * Fix tests. Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>
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!
Signatures
func New() fiber.Handler
Examples
Import the middleware package and assign it to a route.
package main
import (
"log"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/monitor"
)
func main() {
app := fiber.New()
app.Get("/dashboard", monitor.New())
log.Fatal(app.Listen(":3000"))
}
Config
// Config defines the config for middleware.
type Config struct {
// To disable serving HTML, you can make true this option.
//
// Optional. Default: false
APIOnly bool
// Next defines a function to skip this middleware when returned true.
//
// Optional. Default: nil
Next func(c *fiber.Ctx) bool
}
Default Config
var ConfigDefault = Config{
APIOnly: false,
Next: nil,
}