httpserver

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilHandler            = errors.New("Nil Handler")
	ErrNilHandlerValue       = errors.New("Nil Handler value")
	ErrHandlerFuncReturnsNil = errors.New("Handler function returns nil")
)

Functions

This section is empty.

Types

type HandleChainFunc

type HandleChainFunc func(http.Handler) http.Handler

type Logger

type Logger = logger.Logger

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(log Logger, name string, port string, h http.Handler, opts ...ServerOption) *Server

New creates a new httpserver.

func (*Server) Listen

func (s *Server) Listen() error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) String

func (s *Server) String() string

type ServerOption

type ServerOption func(*Server)

func WithHandlers

func WithHandlers(handlers ...HandleChainFunc) ServerOption

WithHandlers adds a handler on the http endpoint. If the handler is nil then an error will occur when executing the Listen() method.

func WithOptionalHandlers added in v0.10.0

func WithOptionalHandlers(handlers ...HandleChainFunc) ServerOption

WithOptionalHandlers adds a handler on the http endpoint. If the handler is nil it is ignored.

Jump to

Keyboard shortcuts

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