apibase

package
v0.0.0-...-822ec7e Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ServiceName string
	Healthy     bool
	Version     string
	BuildInfo   string
	Router      *mux.Router
}

Base holds a standard set of values for all services & APIs

func New

func New(name, ver, info string, healthy bool, rootRouter *mux.Router) *Base

New creates and returns a new Base API instance

func (*Base) HealthCheck

func (api *Base) HealthCheck(resp http.ResponseWriter, req *http.Request)

HealthCheck - Simple health check endpoint, returns 204 when healthy

func (*Base) Send

func (api *Base) Send(data interface{}, resp http.ResponseWriter)

Send is a trivial helper for returning JSON over the API

func (*Base) Status

func (api *Base) Status(resp http.ResponseWriter, req *http.Request)

Status - status information data - Remove if you like

Jump to

Keyboard shortcuts

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