http

package
v0.0.0-...-99a2c5e Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server implements a http server which handles requests using the configured Router.

func NewServer

func NewServer(log *log.Logger, addr string, handler http.Handler) (*Server, error)

NewServer creates a new http server listening on the configured address and using the configured http.Handler to serve requests. An error is returned if the address the server should listen on is already in use.

func (*Server) ListenAddr

func (s *Server) ListenAddr() net.Addr

ListenAddr returns the address the http server is listening on.

func (*Server) ListenError

func (s *Server) ListenError() <-chan error

ListenError returns the receive-only channel which signals errors during http server startup.

func (*Server) Run

func (s *Server) Run()

Run starts the http server in a separate goroutine and pushes errors into the errors channel. This method is non-blocking. Use the ListenError method to listen for errors which occure during startup.

func (*Server) Shutdown

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

Shutdown stops the http server gracefully.

Jump to

Keyboard shortcuts

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