http

package
v0.0.0-...-25191b3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	// Handle should handle HTTP requests.
	Handle(w http.ResponseWriter, r *http.Request)

	// AddRoute should allow the handler to configure itself accepting a router.
	AddRoute(r *mux.Router)
}

Handler is responsible for defining a HTTP request route and corresponding handler.

type NotFoundHandler

type NotFoundHandler struct {
}

NotFoundHandler struct configures and responds to all invalid paths.

func NewNotFoundHandler

func NewNotFoundHandler() *NotFoundHandler

NewNotFoundHandler creates a new NotFoundHandler and returns a pointer.

func (*NotFoundHandler) AddRoute

func (h *NotFoundHandler) AddRoute(r *mux.Router)

AddRoute allows to configure itself accepting a router.

func (*NotFoundHandler) Handle

func (h *NotFoundHandler) Handle(w http.ResponseWriter, r *http.Request)

Handle will handle HTTP requests.

type Service

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

Service is the struct that will hold references to all necessary data for running an http server.

func NewService

func NewService(port int) *Service

NewService will run the setup process and create a Service that can be used to run a http api.

func (*Service) Close

func (s *Service) Close() error

Close will teardown/close any resources used by this http service.

func (*Service) Start

func (s *Service) Start() error

Start will begin listening on the host:port for requests. Blocking call.

Jump to

Keyboard shortcuts

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