@@ -23,14 +23,14 @@ Liveness and readiness probes middleware for [Fiber](https://github.com/gofiber/
23
23
## Signatures
24
24
25
25
``` go
26
- func New (config Config ) fiber .Handler
26
+ func NewHealthChecker (config Config ) fiber .Handler
27
27
```
28
28
29
29
## Examples
30
30
31
31
Import the middleware package that is part of the [Fiber](https:// github.com/gofiber/fiber) web framework
32
32
```go
33
- import (
33
+ import(
34
34
"github.com/gofiber/fiber/v3"
35
35
"github.com/gofiber/fiber/v3/middleware/healthcheck"
36
36
)
@@ -40,26 +40,26 @@ After you initiate your [Fiber](https://github.com/gofiber/fiber) app, you can u
40
40
41
41
```go
42
42
// Provide a minimal config for liveness check
43
- app.Get(healthcheck.DefaultLivenessEndpoint, healthcheck.New ())
43
+ app.Get(healthcheck.DefaultLivenessEndpoint, healthcheck.NewHealthChecker ())
44
44
// Provide a minimal config for readiness check
45
- app.Get(healthcheck.DefaultReadinessEndpoint, healthcheck.New ())
45
+ app.Get(healthcheck.DefaultReadinessEndpoint, healthcheck.NewHealthChecker ())
46
46
// Provide a minimal config for check with custom endpoint
47
- app.Get("/live", healthcheck.New ())
47
+ app.Get("/live", healthcheck.NewHealthChecker ())
48
48
49
49
// Or extend your config for customization
50
- app.Get(healthcheck.DefaultLivenessEndpoint, healthcheck.New (healthcheck.Config{
50
+ app.Get(healthcheck.DefaultLivenessEndpoint, healthcheck.NewHealthChecker (healthcheck.Config{
51
51
Probe: func (c fiber.Ctx ) bool {
52
52
return true
53
53
},
54
54
}))
55
55
// And it works the same for readiness, just change the route
56
- app.Get (healthcheck.DefaultReadinessEndpoint , healthcheck.New (healthcheck.Config {
56
+ app.Get (healthcheck.DefaultReadinessEndpoint , healthcheck.NewHealthChecker (healthcheck.Config {
57
57
Probe : func (c fiber.Ctx ) bool {
58
58
return true
59
59
},
60
60
}))
61
61
// With a custom route and custom probe
62
- app.Get (" /live" , healthcheck.New (healthcheck.Config {
62
+ app.Get (" /live" , healthcheck.NewHealthChecker (healthcheck.Config {
63
63
Probe : func (c fiber.Ctx ) bool {
64
64
return true
65
65
},
@@ -68,7 +68,7 @@ app.Get("/live", healthcheck.New(healthcheck.Config{
68
68
// It can also be used with app.All, although it will only respond to requests with the GET method
69
69
// in case of calling the route with any method which isn't GET, the return will be 404 Not Found when app.All is used
70
70
// and 405 Method Not Allowed when app.Get is used
71
- app.All (healthcheck.DefaultReadinessEndpoint , healthcheck.New (healthcheck.Config {
71
+ app.All (healthcheck.DefaultReadinessEndpoint , healthcheck.NewHealthChecker (healthcheck.Config {
72
72
Probe : func (c fiber.Ctx ) bool {
73
73
return true
74
74
},
0 commit comments