api

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HttpClientTimeout         time.Duration `mapstructure:"http-client-timeout"`
	HttpServerTimeout         time.Duration `mapstructure:"http-server-timeout"`
	HttpServerShutdownTimeout time.Duration `mapstructure:"http-server-shutdown-timeout"`
	BackendURL                string        `mapstructure:"backend-url"`
	UIMessage                 string        `mapstructure:"ui-message"`
	UIColor                   string        `mapstructure:"ui-color"`
	UIPath                    string        `mapstructure:"ui-path"`
	DataPath                  string        `mapstructure:"data-path"`
	ConfigPath                string        `mapstructure:"config-path"`
	Port                      string        `mapstructure:"port"`
	Hostname                  string        `mapstructure:"hostname"`
	RandomDelay               bool          `mapstructure:"random-delay"`
	RandomError               bool          `mapstructure:"random-error"`
	JWTSecret                 string        `mapstructure:"jwt-secret"`
}

type LoggingMiddleware

type LoggingMiddleware struct {
	// contains filtered or unexported fields
}

func NewLoggingMiddleware

func NewLoggingMiddleware(logger *zap.Logger) *LoggingMiddleware

func (*LoggingMiddleware) Handler

func (m *LoggingMiddleware) Handler(next http.Handler) http.Handler

type PrometheusMiddleware

type PrometheusMiddleware struct {
	Histogram *prometheus.HistogramVec
	Counter   *prometheus.CounterVec
}

func NewPrometheusMiddleware

func NewPrometheusMiddleware() *PrometheusMiddleware

func (*PrometheusMiddleware) Handler

func (p *PrometheusMiddleware) Handler(next http.Handler) http.Handler

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewMockServer

func NewMockServer() *Server

func NewServer

func NewServer(config *Config, logger *zap.Logger) (*Server, error)

func (*Server) ErrorResponse

func (s *Server) ErrorResponse(w http.ResponseWriter, r *http.Request, error string, code int)

func (*Server) JSONResponse

func (s *Server) JSONResponse(w http.ResponseWriter, r *http.Request, result interface{})

func (*Server) JSONResponseCode

func (s *Server) JSONResponseCode(w http.ResponseWriter, r *http.Request, result interface{}, responseCode int)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(stopCh <-chan struct{})

Jump to

Keyboard shortcuts

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