app

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Router      *mux.Router
	Address     string
	Environment *env.Environment
	// contains filtered or unexported fields
}

App holds entities that can be used to control the web server

func New

func New(address string, setters ...Option) *App

New returns a new App HTTP server initialized with settings from supplied Opts.

func (*App) InstallRoutes

func (a *App) InstallRoutes(f RouteInstaller)

func (*App) ServeUntilShutdown

func (a *App) ServeUntilShutdown()

ServeUntilShutdown blocks until a shutdown signal is received, then shuts down the HTTP server.

func (*App) Shutdown

func (a *App) Shutdown() error

Shutdown gracefully shuts down the HTTP server.

func (*App) Start

func (a *App) Start()

Start starts a HTTP server and returns immediately.

type Option

type Option func(*Options)

func AllowOrigin

func AllowOrigin(o string) Option

func Environment

func Environment(e env.Environment) Option
func Header(key, value string) Option

func Logger

func Logger(l *logrus.Logger) Option

func StopWait

func StopWait(t time.Duration) Option

type Options

type Options struct {
	Environment       env.Environment
	Headers           map[string]string
	StopWait          time.Duration
	WriteTimeout      time.Duration
	IdleTimeout       time.Duration
	ReadHeaderTimeout time.Duration
	Logger            *logrus.Logger
}

Options holds basic web service settings.

type RouteInstaller

type RouteInstaller func(*mux.Router, *env.Environment)

Jump to

Keyboard shortcuts

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