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.
Click to show internal directories.
Click to hide internal directories.