apiserver

package
v0.0.0-...-7fd672d Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownContentType = errors.New("render: unable to automatically decode the request content type")
	ErrInvalidContentType = errors.New("invalid content type")
	ErrNoFilesUploaded    = errors.New("no files uploaded")
	ErrEntityNotFound     = errors.New("entity not found")
)

Functions

func APIServer

func APIServer(params Params) http.Handler

func Areas

func Areas(areaRegistry registry.AreaRegistry) func(r chi.Router)

func Commodities

func Commodities(params Params) func(r chi.Router)

func GetContentType

func GetContentType(s string) render.ContentType

func GetRequestContentType

func GetRequestContentType(r *http.Request) render.ContentType

GetRequestContentType is a helper function that returns ContentType based on context or request headers.

func JSONAPIAwareDecoder

func JSONAPIAwareDecoder(r *http.Request, v any) error

func Locations

func Locations(locationRegistry registry.LocationRegistry) func(r chi.Router)

func NewInternalServerError

func NewInternalServerError(err error) jsonapi.Error

func NewNotFoundError

func NewNotFoundError(err error) jsonapi.Error

func NewUnprocessableEntityError

func NewUnprocessableEntityError(err error) jsonapi.Error

func Uploads

func Uploads(params Params) func(r chi.Router)

Types

type Params

type Params struct {
	RegistrySet    *registry.Set
	UploadLocation string
}

func (*Params) Validate

func (p *Params) Validate() error

Jump to

Keyboard shortcuts

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