server

package
v0.0.0-...-888f0f9 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJSON

func DecodeJSON(r io.Reader, v interface{}) error

func RenderBlob

func RenderBlob(w http.ResponseWriter, contentType string, blob []byte, cc string) error

func RenderEmptyOK

func RenderEmptyOK(w http.ResponseWriter)

func RenderErrInternal

func RenderErrInternal(w http.ResponseWriter, err error)

func RenderErrInternalWithID

func RenderErrInternalWithID(w http.ResponseWriter, err error) string

func RenderErrInvalidRequest

func RenderErrInvalidRequest(w http.ResponseWriter, err error)

func RenderErrNotFound

func RenderErrNotFound(w http.ResponseWriter)

func RenderErrResourceNotFound

func RenderErrResourceNotFound(w http.ResponseWriter, resource string)

func RenderErrUnauthorized

func RenderErrUnauthorized(w http.ResponseWriter)

func RenderJSON

func RenderJSON(w http.ResponseWriter, code int, v interface{})

RenderJSON writes an http response using the value passed in v as JSON. If it cannot convert the value to JSON, it returns an error

func RenderNoContent

func RenderNoContent(w http.ResponseWriter)

Types

type ErrResponse

type ErrResponse struct {
	Status  string `json:"status,omitempty"`
	Error   string `json:"error,omitempty"`
	ErrorID string `json:"error_id,omitempty"`
}

type Server

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

func New

func New(config *koanf.Koanf) (*Server, error)

New will setup the API listener

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(config *koanf.Koanf) error

ListenAndServe will listen for requests

func (*Server) Router

func (s *Server) Router() chi.Router

Router returns the router

Jump to

Keyboard shortcuts

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