httpserver

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 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(port string) (*Server, error)

New creates an instance of an HTTP server.

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(ctx context.Context) error

Serve starts the HTTP server and listens on the configured port. It will block forever unless the server fails. When the provided context terminates, the server will gracefully shutdown.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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