diff --git a/healthchecks/healthchecks.go b/healthchecks/healthchecks.go new file mode 100644 index 0000000..ad0a945 --- /dev/null +++ b/healthchecks/healthchecks.go @@ -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) + } +}