baseftrwapp

package
v0.0.0-...-734a889 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT Imports: 20 Imported by: 37

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OutputMetricsIfRequired

func OutputMetricsIfRequired(graphiteTCPAddress string, graphitePrefix string, logMetrics bool)

OutputMetricsIfRequired will send metrics to Graphite if a non-empty graphiteTCPAddress is passed in, or to the standard log if logMetrics is true. Make sure a sensible graphitePrefix that will uniquely identify your service is passed in, e.g. "content.test.people.rw.neo4j.ftaps58938-law1a-eu-t

func RunServer

func RunServer(services map[string]Service, healthHandler func(http.ResponseWriter, *http.Request), port int, serviceName string, env string)

RunServer will set up GET, PUT and DELETE endpoints for the specified path, calling the appropriate service functions: PUT -> Write GET -> Read DELETE -> Delete It will also setup the healthcheck and ping endpoints Endpoints are wrapped in a metrics timer and request loggin including transactionID, which is generated if not found on the request as X-Request-Id header

func RunServerWithConf

func RunServerWithConf(conf RWConf)

Types

type RWConf

type RWConf struct {
	Services      map[string]Service
	HealthHandler func(http.ResponseWriter, *http.Request)
	Port          int
	ServiceName   string
	Env           string
	EnableReqLog  bool
	OpenAPIData   []byte
}

type Service

type Service rwapi.Service

Jump to

Keyboard shortcuts

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