utils

package
Version: v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GracefulShutdown added in v1.0.6

func GracefulShutdown(server *http.Server)

GracefulShutdown accepts a server reference and triggers a graceful shutdown for it when either SIGINT or SIGTERM is received.

func Handler

func Handler(w http.ResponseWriter, r *http.Request, h Handle)

Handler receives an HTTP request and response and a handler function It manages timeouts and prometheus metrics

func NewServer added in v1.0.6

func NewServer(mux *http.ServeMux) *http.Server

NewServer returns an HTTP server ready to listen on the configured port and with logReq mixed in for logging.

func PromHTTPHandler added in v1.0.7

func PromHTTPHandler() http.Handler

PromHTTPHandler to expose the metrics, invoked in the golang runtime

Types

type Handle

type Handle func(ctx context.Context, w http.ResponseWriter, r *http.Request) ([]byte, error)

Handle type receive the context elements of a HTTP request to process it

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL