server

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware added in v0.2.2

type Middleware func(client.IFace) func(http.Handler) http.Handler

Middleware helper type for handlers that receive a `Client`.

type Server

type Server struct {
	Client client.IFace
	Router *mux.Router
	// contains filtered or unexported fields
}

Server HTTP API for accessing `Features`

func New

func New(cfg *config.Config, dcdr client.IFace) (srv *Server)

New create a new `Server`

func NewDefault

func NewDefault() (srv *Server, err error)

NewDefault creates a new `Server` using `config.hcl`.

func (*Server) FeaturesHandler added in v0.2.2

func (srv *Server) FeaturesHandler() http.Handler

FeaturesHandler delegates to `handlers.FeaturesHandler` and adds the middleware chain.

func (*Server) RegisterRoutes added in v0.2.2

func (srv *Server) RegisterRoutes()

RegisterRoutes binds `Endpoint` to the `FeaturesHandler`.

func (*Server) Serve

func (srv *Server) Serve() error

Serve starts the server on the configured `Host`.

func (*Server) ServeHTTP added in v0.2.2

func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP registers the `HTTPCachingHandler` and sets up the route handlers and logging.

func (*Server) Use

func (srv *Server) Use(h ...Middleware)

Use appends `Middleware` to the internal chain.

func (*Server) WithMiddleware added in v0.2.2

func (srv *Server) WithMiddleware(h http.Handler) http.Handler

WithMiddleware adds the middleware chain to `h` passing each the `Client`.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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