httpserver

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 8 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 {
	Host string
	// contains filtered or unexported fields
}

Server defines a server that listens on HTTP requests.

func New

func New(ctx context.Context, port string, unsecured bool) (*Server, error)

New creates an instance of an HTTP server. When the provided context terminates, the server will gracefully shutdown.

func (*Server) RegisterHandler

func (srv *Server) RegisterHandler(method, path string, h http.Handler)

RegisterEndpoint registers the specified method and path endpoint with the request handler reqHandler. The resource type rt is provided for shared handlers.

func (*Server) Serve

func (srv *Server) Serve() error

Serve starts the HTTP server and listens on the configured port. It will block forever unless the server fails.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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