Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DevClusterServer ¶
type DevClusterServer struct {
// contains filtered or unexported fields
}
DevClusterServer bundles configuration, and HTTP server objects in a single location.
func New ¶
func New(config *configuration.Config) *DevClusterServer
New creates a new DevClusterServer object with reasonable defaults.
func (*DevClusterServer) Config ¶
func (srv *DevClusterServer) Config() *configuration.Config
Config returns the app server's config object.
func (*DevClusterServer) Engine ¶
func (srv *DevClusterServer) Engine() *gin.Engine
Engine returns the app server's HTTP router.
func (*DevClusterServer) GetRegisteredRoutes ¶
func (srv *DevClusterServer) GetRegisteredRoutes() string
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 (*DevClusterServer) HTTPServer ¶
func (srv *DevClusterServer) HTTPServer() *http.Server
HTTPServer returns the app server's HTTP server.
func (*DevClusterServer) SetupRoutes ¶
func (srv *DevClusterServer) SetupRoutes() error
SetupRoutes registers handlers for various URL paths.
type StaticHandler ¶
type StaticHandler struct {
Assets http.FileSystem
}
StaticHandler implements the http.Handler interface, so we can use it to respond to HTTP requests. The path to the static directory and path to the index file within that static directory are used to serve the SPA in the given static directory.
func (StaticHandler) ServeHTTP ¶
func (h StaticHandler) ServeHTTP(ctx *gin.Context)
ServeHTTP inspects the URL path to locate a file within the static dir on the SPA handler. If a file is found, it will be served. If not, the file located at the index path on the SPA handler will be served. This is suitable behavior for serving an SPA (single page application).