foo

package
v0.0.0-...-cee63af Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMap = map[error]resterr.RESTErr{
	foo.ErrGetFaleid: {
		StatusCode: http.StatusTeapot,
		Message:    "could not perform the get foo operation",
	},
}

ErrMap is the mapping between business layer errors (services) and the JSON errors we want to send back from the REST API.

All expected errors resulting from downstream processing should be mapped here. Errors that are not mapped are sent to the client as a 500 error without details.

Functions

This section is empty.

Types

type FooHandler

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

FooHandler implements HTTP handlers and processes requests related to the foo resource.

func NewHandler

func NewHandler(logger *slog.Logger, fooSvc fooService, errHandler errHandler) (*FooHandler, error)

NewHandler instantiates a new FooHandler struct.

func (*FooHandler) Get

func (fh *FooHandler) Get(w http.ResponseWriter, r *http.Request)

Get mimics an HTTP handler for fetching a foo resource.

Jump to

Keyboard shortcuts

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