api

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPC

type GRPC struct {
	Server *grpc.Server
	// contains filtered or unexported fields
}

GRPC controller.

func NewGRPC

func NewGRPC(address string) *GRPC

NewGRPC creates a new gRPC controller and respective API. TODO: convert parameters to a Configuration struct

func (*GRPC) IsRunning

func (rpc *GRPC) IsRunning() bool

IsRunning returns true if the gRPC service is running and listening for connections.

func (*GRPC) Start

func (rpc *GRPC) Start() error

Start initializes the gRPC server. This is a blocking operation.

func (*GRPC) Stop

func (rpc *GRPC) Stop() error

Stop attempts to shutdown gracefully.

type LogHandler added in v0.2.3

type LogHandler func(message string, fields map[string]interface{})

LogHandler ...

type WebAPI

type WebAPI struct {
	EchoServer *echo.Echo
	// contains filtered or unexported fields
}

WebAPI ...

func NewWebAPI

func NewWebAPI(address string, opts ...WebAPIOption) *WebAPI

NewWebAPI ...

func (*WebAPI) RegisterAdminRoutes added in v0.1.2

func (api *WebAPI) RegisterAdminRoutes(prefix string)

RegisterAdminRoutes registers preset handlers for <prefix>/admin/shutdown

func (*WebAPI) RegisterDebugRoutes added in v0.1.2

func (api *WebAPI) RegisterDebugRoutes(prefix string)

RegisterDebugRoutes registers preset handlers for <prefix>/debug/profile/cpu and <prefix>/debug/profile/mem

func (*WebAPI) RegisterHealthRoutes added in v0.1.2

func (api *WebAPI) RegisterHealthRoutes(prefix string)

RegisterHealthRoutes registers preset handlers for <prefix>/health/stats.

func (*WebAPI) RegisterRoute

func (api *WebAPI) RegisterRoute(method, route string, handler func(context echo.Context) error)

RegisterRoute registers a new handler for a route.

func (*WebAPI) Start

func (api *WebAPI) Start() error

Start launches the HTTP Server and writes the exit

func (*WebAPI) Static

func (api *WebAPI) Static(prefix, root string)

Static serves static files under the provided root folder. Deprecated since the underlying Echo server is exposed as .EchoServer.

func (*WebAPI) Stop

func (api *WebAPI) Stop() error

Stop performs a clean shutdown of the server.

type WebAPIOption added in v0.2.0

type WebAPIOption func(api *WebAPI)

WebAPIOption is the functional parameter type used to configure WebAPI.

func WithWebAPILogHandler added in v0.2.3

func WithWebAPILogHandler(lh LogHandler) WebAPIOption

WithWebAPILogHandler allows seting a log handler for doing request logging instead of the default WebAPI logger.

func WithWebAPILogger added in v0.2.0

func WithWebAPILogger(l log.Logger) WebAPIOption

WithWebAPILogger returns an option to set the WebAPI logger.

Jump to

Keyboard shortcuts

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