httpsimple

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: Apache-2.0 Imports: 14 Imported by: 4

README

httpsimple

Go library for simple HTTP servers

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicHandler

func BasicHandler(handler func(request *http.Request) CanHTTPWrite, l *zapctx.Logger) http.Handler

func BasicServerRun

func BasicServerRun(logger *zapctx.Logger, server *http.Server, onListen func(listener net.Listener), addr string) error

func HealthHandler

func HealthHandler(z *zapctx.Logger, tracer gotracing.Tracing) http.Handler

func LogMiddleware

func LogMiddleware(logger *zapctx.Logger, filterFunc func(req *http.Request) bool) func(handler http.Handler) http.Handler

func MuxMiddleware

func MuxMiddleware() func(handler http.Handler) http.Handler

func NotFoundHandler

func NotFoundHandler(logger *zapctx.Logger) http.Handler

Types

type BasicResponse

type BasicResponse struct {
	Code    int
	Msg     io.WriterTo
	Headers map[string]string
}

func (*BasicResponse) HTTPWrite

func (g *BasicResponse) HTTPWrite(ctx context.Context, w http.ResponseWriter, l *zapctx.Logger)

type CanHTTPWrite

type CanHTTPWrite interface {
	HTTPWrite(ctx context.Context, w http.ResponseWriter, l *zapctx.Logger)
}

type DebugServer added in v0.0.2

type DebugServer struct {
	http.Server
	ListenAddr string
	Logger     *zapctx.Logger
	// contains filtered or unexported fields
}

func (*DebugServer) Close added in v0.0.2

func (d *DebugServer) Close() error

func (*DebugServer) Setup added in v0.0.2

func (d *DebugServer) Setup() error

func (*DebugServer) Start added in v0.0.2

func (d *DebugServer) Start() error

Jump to

Keyboard shortcuts

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