Version: v1.0.12 Latest Latest

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

Go to latest
Published: Jul 6, 2020 License: Apache-2.0 Imports: 18 Imported by: 0



Package api provides controllers for each api endpoint. Controllers are "dumb wiring"; there is little to no application logic in this package. Controllers call and coordinate other packages to satisfy the api endpoint. Authentication and authorization happen in controllers.



View Source
const (
	API_ROOT = "/api/v1/"


View Source
var (
	// Error when Request Manager is shutting down and not starting new requests
	ErrShuttingDown = errors.New("Request Manager is shutting down - no new requests are being started")


This section is empty.


type API

type API struct {
	// contains filtered or unexported fields

API provides controllers for endpoints it registers with a router. It satisfies the http.HandlerFunc interface.

func NewAPI

func NewAPI(appCtx app.Context) *API

NewAPI creates a new API struct. It initializes an echo web server within the struct, and registers all of the API's routes with it.

func (*API) Router added in v1.0.2

func (api *API) Router() *echo.Echo

func (*API) Run

func (api *API) Run() error

Run makes the API listen on the configured address.

func (*API) ServeHTTP

func (api *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP makes the API implement the http.HandlerFunc interface.

func (*API) Stop

func (api *API) Stop() error

Stop stops the API when it's running. When Stop is called, Run returns immediately. Make sure to wait for Stop to return.

Source Files

Jump to

Keyboard shortcuts

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