httpserver

package
v0.0.0-...-ad9f295 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MonitorMiddleware = MiddlewareFunc(func(next http.Handler) http.Handler {
	return &ochttp.Handler{
		Propagation: monitoring.HTTPFormat,
		Handler:     next,
	}
})
View Source
var TokenCtxKey common.ContextKey

Functions

func DataResponse

func DataResponse(value interface{}) map[string]interface{}

func MakeHandler

func MakeHandler(
	m *mux.Router,
	validator *auth.Validator,
	logger logging.Logger,
) http.Handler

func MakeHandlerWithGraphQL

func MakeHandlerWithGraphQL(
	m *mux.Router,
	schema *graphql.Schema,
	opt *GraphQLHandlerOptions,
	validator *auth.Validator,
	logger logging.Logger,
) http.Handler

Types

type ErrorMessage

type ErrorMessage struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type ErrorResponse

type ErrorResponse struct {
	Error ErrorMessage `json:"error"`
}

type GraphQLHandlerOptions

type GraphQLHandlerOptions struct {
	Path           string
	EnableGraphIQL bool
}

type Middleware

type Middleware interface {
	Middleware(next http.Handler) http.Handler
}
var (
	ProxyMiddleware   Middleware = MiddlewareFunc(handlers.ProxyHeaders)
	LoggingMiddleware Middleware = MiddlewareFunc(func(next http.Handler) http.Handler {
		return handlers.CombinedLoggingHandler(os.Stdout, next)
	})
)
var CorsMiddleware Middleware

func NewAuthMiddleware

func NewAuthMiddleware(validator *auth.Validator) Middleware

func NewLoggingMiddleware

func NewLoggingMiddleware(w io.Writer) Middleware

func NewPanicMiddleware

func NewPanicMiddleware(logger logging.Logger) Middleware

type MiddlewareChain

type MiddlewareChain []Middleware

func NewDefaultMiddlewareChain

func NewDefaultMiddlewareChain(logger logging.Logger) MiddlewareChain

func (MiddlewareChain) Build

func (mc MiddlewareChain) Build(mux *mux.Router) (h http.Handler)

type MiddlewareFunc

type MiddlewareFunc func(next http.Handler) http.Handler

func (MiddlewareFunc) Middleware

func (mf MiddlewareFunc) Middleware(next http.Handler) http.Handler

Jump to

Keyboard shortcuts

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