api

package
v0.0.0-...-8501d73 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DEFAULT_STATSD_RATE = 1.0
)

Variables

This section is empty.

Functions

func WriteJSONStatus

func WriteJSONStatus(rw http.ResponseWriter, status, message string, statusCode int)

Types

type Api

type Api struct {
	Config       *config.Config
	Version      string
	Dependencies *deps.Dependencies
}

func New

func New(cfg *config.Config, d *deps.Dependencies, version string) *Api

func (*Api) Handle

func (a *Api) Handle(handlers map[string]Handler) http.Handler

func (*Api) HealthHandler

func (a *Api) HealthHandler(rw http.ResponseWriter, r *http.Request) *DetailedError

func (*Api) HomeHandler

func (a *Api) HomeHandler(rw http.ResponseWriter, r *http.Request) *DetailedError

func (*Api) Run

func (a *Api) Run() error

func (*Api) VersionHandler

func (a *Api) VersionHandler(rw http.ResponseWriter, r *http.Request) *DetailedError

type DetailedError

type DetailedError struct {
	Error      error
	StatusCode int
}

type ExtendedJSONStatus

type ExtendedJSONStatus struct {
	Message string `json:"message"`
	Status  string `json:"status"`
}

type JSONStatus

type JSONStatus struct {
	Message string `json:"message"`
	Status  string `json:"status"`
}

Jump to

Keyboard shortcuts

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