listener

package
v0.0.0-...-8f845b4 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package listener provides methods for parts of the server where a listener will bind to a host and port to provide services to external systems/users.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPListenerService

type HTTPListenerService struct {
	Address string
	Port    int
	Context *middleware.AppContext

	Router                 *mux.Router
	BaseMiddlewareHandlers alice.Chain
}

HTTPListenerService is a structure which provides an HTTP listener to service requests. This structure offers methods to add routes and middlewares. Typical usage would first call NewHTTPListenerService(), add routes, then call StartHTTPListener.

func NewHTTPListenerService

func NewHTTPListenerService(
	address string,
	port int,
	appContext *middleware.AppContext,
) *HTTPListenerService

NewHTTPListenerService creates a new instance of the HTTPListenerService

func (*HTTPListenerService) AddMiddleware

func (service *HTTPListenerService) AddMiddleware(middlewareHandler alice.Constructor) *HTTPListenerService

AddMiddleware adds a new middleware handler to the request chain.

func (*HTTPListenerService) AddRoute

func (service *HTTPListenerService) AddRoute(
	path string,
	handlerFunc http.HandlerFunc, methods ...string,
) *HTTPListenerService

AddRoute adds a HTTP handler route to the HTTP listener.

func (*HTTPListenerService) AddRouteWithMiddleware

func (service *HTTPListenerService) AddRouteWithMiddleware(
	path string,
	handlerFunc http.HandlerFunc,
	middlewareHandler alice.Constructor,
	methods ...string,
) *HTTPListenerService

AddRouteWithMiddleware adds a HTTP handler route that goes through an additional middleware handler, to the HTTP listener.

func (*HTTPListenerService) AddStaticRoute

func (service *HTTPListenerService) AddStaticRoute(pathPrefix string, directory string) *HTTPListenerService

AddStaticRoute adds a HTTP handler route for static assets.

func (*HTTPListenerService) StartHTTPListener

func (service *HTTPListenerService) StartHTTPListener() error

StartHTTPListener starts the HTTP listener and servicing requests.

Jump to

Keyboard shortcuts

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