add healts check to common
This commit is contained in:
parent
44b37825e8
commit
4560248259
18
healthchecks/healthchecks.go
Normal file
18
healthchecks/healthchecks.go
Normal file
@ -0,0 +1,18 @@
|
||||
package healthchecks
|
||||
|
||||
import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func Liveness(c *fiber.Ctx) error {
|
||||
return c.SendStatus(fiber.StatusOK)
|
||||
}
|
||||
|
||||
func Readiness(err *error) fiber.Handler {
|
||||
return func(c *fiber.Ctx) error {
|
||||
if *err != nil {
|
||||
return c.SendString((*err).Error())
|
||||
}
|
||||
return c.SendStatus(fiber.StatusOK)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user