handlers

package
v0.0.0-...-e26ef75 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 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 GenericError

type GenericError struct {
	Message string `json:"message"`
}

GenericError is a generic error message returned by a server

type Products

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

Products handler for getting and updating products

func NewProducts

func NewProducts(l *log.Logger) *Products

NewProducts returns a new products handler with the given logger

func (*Products) CreateProduct

func (p *Products) CreateProduct(rw http.ResponseWriter, r *http.Request)

CreateProduct handles post requests to add new products

func (*Products) ListProducts

func (p *Products) ListProducts(rw http.ResponseWriter, r *http.Request)

ListProducts handles HTTP GET requests for the products

func (*Products) ListSingle

func (p *Products) ListSingle(rw http.ResponseWriter, r *http.Request)

ListSingle handles GET requests

func (*Products) MiddlewareValidateProduct

func (p *Products) MiddlewareValidateProduct(next http.Handler) http.Handler

MiddlewareValidateProduct validates the product in the request and calls next if ok

func (*Products) UpdateProduct

func (p *Products) UpdateProduct(rw http.ResponseWriter, r *http.Request)

UpdateProduct handles PUT requests to update products

Jump to

Keyboard shortcuts

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