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 ¶
- Variables
- type AppServer
- func (srv *AppServer) Config() *configuration.Registry
- func (srv *AppServer) GetRegisteredRoutes() (string, error)
- func (srv *AppServer) HTTPServer() *http.Server
- func (srv *AppServer) HandleStatus() http.HandlerFunc
- func (srv *AppServer) HandleTopology() http.HandlerFunc
- func (srv *AppServer) Logger() *log.Logger
- func (srv *AppServer) Router() *mux.Router
- func (srv *AppServer) SetupRoutes() error
Constants ¶
This section is empty.
Variables ¶
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 (*AppServer) Config ¶
func (srv *AppServer) Config() *configuration.Registry
Config returns the app server's config object
func (*AppServer) GetRegisteredRoutes ¶
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 ¶
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) SetupRoutes ¶
SetupRoutes registers handlers for various URL paths. You can call this function more than once but only the first call will have an effect.