Documentation
¶
Overview ¶
package handler provides a collection of useful/built-in handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// Handler function.
Handler http.HandlerFunc
// Method to run the `Handler`.
Method string
// Path to run the `Handler`.
Path string
}
Handler definition.
func Liveness ¶
func Liveness() Handler
Liveness indicates the server is up, and running. It follows the "standard" which is send `200` status code, and "OK" in the body.
func New ¶
func New(method string, path string, handler http.HandlerFunc) Handler
New is `Handler` factory.
func Readiness ¶
func Readiness(readinessFunc ReadinessFunc) Handler
Readiness indicates the server is up, running, and ready to work. It follows the "standard" which is send `200` status code, and "OK" in the body if it's ready, otherwise sends `503`, "Service Unavailable", and the error.
type ReadinessFunc ¶
type ReadinessFunc func() error
ReadinessFunc determines readiness. If error isn't `nil`, it means server isn't ready.
NOTE: Be mindful that a readiness probe performs this every N-{s|ms}.
Click to show internal directories.
Click to hide internal directories.