chain

package
Version: v0.0.0-...-41c5128 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MethodNotAllowedHandler

func MethodNotAllowedHandler(method string) func(w http.ResponseWriter, r *http.Request)

MethodNotAllowedHandler returns a method not allowed handler - Implements vestigo.MethodNotAllowedHandlerFunc

func NotFoundHandler

func NotFoundHandler(w http.ResponseWriter, r *http.Request)

NotFoundHandler is the generic not found handler to return a problem

Types

type Measurer

type Measurer interface {
	Measure(name string, handler http.Handler) http.HandlerFunc
}

Measurer can setup a Measured chain

func NewBase

func NewBase(b alice.Chain, timer middleware.Timer, logger middleware.Logger) Measurer

NewBase gets a new measurer with the provided base chain Expected usage: t, err := middleware.NewNewrelicTimer(env, serviceName, nrKey) if err != nil {

log.Fatalf("Could not instantiate newrelic timer: %v", err)

} b := chain.NewBase(alice.New(), t, middleware.NewLogrusLogger(logrus.NewEntry(logrus.New()))) router.Get("/user", b.Measure("get users", user.Get()))

func NewBaseWithExtras

func NewBaseWithExtras(b alice.Chain, timer middleware.Timer, logger middleware.Logger, constructors ...alice.Constructor) Measurer

NewBaseWithExtras similar to NewBase but allows users to pass in a set of additional constructors to append the the base chain

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL