Skip to content

Commit 7ff5c34

Browse files
Refactor Documenation for HealthCheck (#2905)
* Refactor Documenation for HealthCheck * Update docs/api/middleware/healthcheck.md --------- Co-authored-by: RW <[email protected]>
1 parent 3b982aa commit 7ff5c34

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/api/middleware/healthcheck.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ Liveness and readiness probes middleware for [Fiber](https://github.com/gofiber/
2323
## Signatures
2424

2525
```go
26-
func New(config Config) fiber.Handler
26+
func NewHealthChecker(config Config) fiber.Handler
2727
```
2828

2929
## Examples
3030

3131
Import the middleware package that is part of the [Fiber](https://github.com/gofiber/fiber) web framework
3232
```go
33-
import (
33+
import(
3434
"github.com/gofiber/fiber/v3"
3535
"github.com/gofiber/fiber/v3/middleware/healthcheck"
3636
)
@@ -40,26 +40,26 @@ After you initiate your [Fiber](https://github.com/gofiber/fiber) app, you can u
4040

4141
```go
4242
// Provide a minimal config for liveness check
43-
app.Get(healthcheck.DefaultLivenessEndpoint, healthcheck.New())
43+
app.Get(healthcheck.DefaultLivenessEndpoint, healthcheck.NewHealthChecker())
4444
// Provide a minimal config for readiness check
45-
app.Get(healthcheck.DefaultReadinessEndpoint, healthcheck.New())
45+
app.Get(healthcheck.DefaultReadinessEndpoint, healthcheck.NewHealthChecker())
4646
// Provide a minimal config for check with custom endpoint
47-
app.Get("/live", healthcheck.New())
47+
app.Get("/live", healthcheck.NewHealthChecker())
4848

4949
// Or extend your config for customization
50-
app.Get(healthcheck.DefaultLivenessEndpoint, healthcheck.New(healthcheck.Config{
50+
app.Get(healthcheck.DefaultLivenessEndpoint, healthcheck.NewHealthChecker(healthcheck.Config{
5151
Probe: func(c fiber.Ctx) bool {
5252
return true
5353
},
5454
}))
5555
// 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{
5757
Probe: func(c fiber.Ctx) bool {
5858
return true
5959
},
6060
}))
6161
// With a custom route and custom probe
62-
app.Get("/live", healthcheck.New(healthcheck.Config{
62+
app.Get("/live", healthcheck.NewHealthChecker(healthcheck.Config{
6363
Probe: func(c fiber.Ctx) bool {
6464
return true
6565
},
@@ -68,7 +68,7 @@ app.Get("/live", healthcheck.New(healthcheck.Config{
6868
// It can also be used with app.All, although it will only respond to requests with the GET method
6969
// 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
7070
// 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{
7272
Probe: func(c fiber.Ctx) bool {
7373
return true
7474
},

0 commit comments

Comments
 (0)