2020-09-29 01:28:43 +02:00
# Monitor
2020-09-29 02:38:24 +02:00
Monitor middleware for [Fiber ](https://github.com/gofiber/fiber ) that reports server metrics, inspired by [express-status-monitor ](https://github.com/RafalWilinski/express-status-monitor )
2020-09-29 01:28:43 +02:00
2021-04-06 18:51:53 +05:30
:warning: **Warning:** Monitor is still in beta, API might change in the future!
2021-09-22 09:29:44 +03:00

2020-09-29 01:28:43 +02:00
### Signatures
```go
func New() fiber.Handler
```
### Examples
2020-09-29 02:36:15 +02:00
Import the middleware package and assign it to a route.
2020-09-29 01:28:43 +02:00
```go
2020-09-29 02:35:41 +02:00
package main
2020-09-29 01:28:43 +02:00
import (
2020-09-29 02:35:41 +02:00
"log"
2020-09-29 01:28:43 +02:00
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/monitor"
)
2020-09-29 02:35:41 +02:00
func main() {
app := fiber.New()
2020-09-29 02:36:15 +02:00
2020-09-29 02:35:41 +02:00
app.Get("/dashboard", monitor.New())
2020-09-29 02:36:15 +02:00
2020-09-29 02:35:41 +02:00
log.Fatal(app.Listen(":3000"))
}
```
2021-09-13 09:51:44 +03:00
## Config
```go
// Config defines the config for middleware.
type Config struct {
// Next defines a function to skip this middleware when returned true.
//
// Optional. Default: nil
Next func(c *fiber.Ctx) bool
}
```
## Default Config
```go
var ConfigDefault = Config{
Next: nil,
}
```