{"modulePath":"github.com/codeready-toolchain/devcluster","version":"v0.0.0-20220126183047-e35233a30c3d","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package server\n\n## Types\n\n```go\ntype DevClusterServer struct {\n\t// contains filtered or unexported fields\n}\n```\nDevClusterServer bundles configuration, and HTTP server objects in a single location.\n\n```go\nfunc New(config *configuration.Config) *DevClusterServer\n```\nNew creates a new DevClusterServer object with reasonable defaults.\n\n```go\nfunc (srv *DevClusterServer) Config() *configuration.Config\n```\nConfig returns the app server's config object.\n\n```go\nfunc (srv *DevClusterServer) Engine() *gin.Engine\n```\nEngine returns the app server's HTTP router.\n\n```go\nfunc (srv *DevClusterServer) GetRegisteredRoutes() string\n```\nGetRegisteredRoutes 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.\n\n```go\nfunc (srv *DevClusterServer) HTTPServer() *http.Server\n```\nHTTPServer returns the app server's HTTP server.\n\n```go\nfunc (srv *DevClusterServer) SetupRoutes() error\n```\nSetupRoutes registers handlers for various URL paths.\n\n```go\ntype StaticHandler struct {\n\tAssets http.FileSystem\n}\n```\nStaticHandler 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.\n\n```go\nfunc (h StaticHandler) ServeHTTP(ctx *gin.Context)\n```\nServeHTTP 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).\n\n","path":"github.com/codeready-toolchain/devcluster/pkg/server","name":"server","synopsis":"","isRedistributable":true}
