rest

package
v0.0.0-...-5dd97c0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InvalidRequest

func InvalidRequest(
	w http.ResponseWriter,
	r *http.Request,
	err error,
	message string,
	httpCode int,
)

InvalidRequest handles API errors.

func ToJSON

func ToJSON(
	w http.ResponseWriter,
	httpCode int,
	dest interface{},
)

ToJSON returns a JSON response.

Types

type APIMessage

type APIMessage struct {
	Message string `json:"message,omitempty"`
	Status  int    `json:"status,omitempty"`
}

APIMessage is a struct for generic JSON response.

Jump to

Keyboard shortcuts

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