endpoints

package
v0.0.0-...-d6647d3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: MIT Imports: 4 Imported by: 7

Documentation

Index

Constants

View Source
const (
	ContentType     = "Content-Type"
	ApplicationJSON = "application/json"
)

Variables

This section is empty.

Functions

func CheckError

func CheckError(w http.ResponseWriter, response interface{}) (bool, error)

func Description

func Description(intro string, v version.Version) http.Handler

func EncodeResponse

func EncodeResponse(w http.ResponseWriter, response interface{}) error

EncodeResponse encodes a generic response

func Err

func Err(cause error, status int) error

Err wraps a cause with a status code

Types

type Error

type Error struct {
	Cause  error
	Status int
}

Error is a wrapper struct that provides HTTP Status code to an error

func (Error) Error

func (e Error) Error() string

func (Error) MarshalJSON

func (e Error) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler

type Route

type Route struct {
	Path    string
	Method  string
	Handler http.Handler
}

Route contains endpoint information

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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