appserver

package
v0.0.0-...-7ff13f1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package appserver provides a Server structure that let's you package things you need all around your service (e.g. configuration, HTTP mgmt, logging, routing, etc.)

Index

Constants

This section is empty.

Variables

View Source
var (
	// Commit current build commit set by build script
	Commit = "0"
	// BuildTime set by build script in ISO 8601 (UTC) format:
	// YYYY-MM-DDThh:mm:ssTZD (see https://www.w3.org/TR/NOTE-datetime for
	// details)
	BuildTime = "0"
	// StartTime in ISO 8601 (UTC) format
	StartTime = time.Now().UTC().Format("2006-01-02T15:04:05Z")
)

Functions

This section is empty.

Types

type AppServer

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

AppServer bundles configuration, logging, and HTTP server objects in a single location.

func New

func New(configFilePath string) (*AppServer, error)

New creates a new AppServer object with reasonable defaults.

func (*AppServer) Config

func (srv *AppServer) Config() *configuration.Registry

Config returns the app server's config object

func (*AppServer) GetRegisteredRoutes

func (srv *AppServer) GetRegisteredRoutes() (string, error)

GetRegisteredRoutes returns all registered routes formatted with their methods, paths, queries and names. It is a good idea to print this information on server start to give you an idea of what routes are available in the system.

func (*AppServer) HTTPServer

func (srv *AppServer) HTTPServer() *http.Server

HTTPServer returns the app server's HTTP server

func (*AppServer) HandleStatus

func (srv *AppServer) HandleStatus() http.HandlerFunc

HandleStatus returns the handler function for the /status endpoint

func (*AppServer) HandleTopology

func (srv *AppServer) HandleTopology() http.HandlerFunc

HandleTopology returns the handler function for the /status endpoint.

func (*AppServer) Logger

func (srv *AppServer) Logger() *log.Logger

Logger returns the app server's log object

func (*AppServer) Router

func (srv *AppServer) Router() *mux.Router

Router returns the app server's HTTP router

func (*AppServer) SetupRoutes

func (srv *AppServer) SetupRoutes() error

SetupRoutes registers handlers for various URL paths. You can call this function more than once but only the first call will have an effect.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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