http

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHealthcheckHandler

func NewHealthcheckHandler(dbServiceAlive serviceUpCheck) http.HandlerFunc

NewHealthcheckHandler creates a HTTP handler for serving a healthcheck endpoint.

func NewTodosHandler

func NewTodosHandler(fetch fetchTodos) http.HandlerFunc

NewTodosHandler creates a HTTP handler for serving a list of todos.

Types

type Endpoints

type Endpoints struct {
	Healthcheck http.HandlerFunc
	Todos       http.HandlerFunc
}

Endpoints specifies the Todo API endpoint configurations as a list of http.Handlers.

type Router

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

Router represents a Todo's HTTP router, with the appropriate endpoints configured.

func NewRouter

func NewRouter(endpoints Endpoints, log zerolog.Logger) *Router

NewRouter provides REST endpoint routing for the Todo API

func (*Router) Serve

func (router *Router) Serve(w http.ResponseWriter, r *http.Request)

Serve a HTTP request

func (*Router) ServeOn

func (router *Router) ServeOn(port int) error

ServeOn serves the router endpoints on the supplied port.

Jump to

Keyboard shortcuts

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