api

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthCheckHandler

func HealthCheckHandler(w http.ResponseWriter, r *http.Request)

HealthCheckHandler - Implements the Health check via http handler

func StartHTTPListener

func StartHTTPListener(config Config)

StartHTTPListener - Starts the Http server. Uses the mux provided example starter and adds common middleware + router setup interface TODO: Change additional hard codes to env variables

func WriteDeleteAPIResponse

func WriteDeleteAPIResponse(ctx context.Context, w http.ResponseWriter, r *http.Request, err error)

WriteDeleteAPIResponse - writes Delete responses

func WriteGetAPIResponse

func WriteGetAPIResponse(ctx context.Context, w http.ResponseWriter, r *http.Request, jsonResponse interface{}, err error)

WriteGetAPIResponse - writes GET responses

func WritePatchAPIResponse

func WritePatchAPIResponse(ctx context.Context, w http.ResponseWriter, r *http.Request, err error)

WritePatchAPIResponse - writes Patch responses

func WritePostAPIResponse

func WritePostAPIResponse(ctx context.Context, w http.ResponseWriter, r *http.Request, resourceLocation string, err error)

WritePostAPIResponse - writes POST responses

func WritePutAPIResponse

func WritePutAPIResponse(ctx context.Context, w http.ResponseWriter, r *http.Request, err error)

WritePutAPIResponse - writes PUT responses

Types

type Config

type Config interface {
	SetupRoutes(router *mux.Router)
	StartServer() bool
}

Config - Interface to setup API specific routes

type Health

type Health interface {
	Healthy() bool
}

Health - Interface can be set by caller using --> setHealthChecker(health APIHealth) If not set, only core architecture health checks will be performed

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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