Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultStaticConfig is the default Static middleware config. DefaultStaticConfig = StaticConfig{ Skipper: skipper.DefaultSkipper, Index: "index.html", } )
Functions ¶
func Static ¶
Static returns a Static middleware to serves static content from the provided root directory.
func StaticWithConfig ¶
func StaticWithConfig(config StaticConfig) macross.Handler
StaticWithConfig returns a Static middleware with config. See `Static()`.
Types ¶
type StaticConfig ¶
type StaticConfig struct {
// Skipper defines a function to skip middleware.
Skipper skipper.Skipper
// Root directory from where the static content is served.
// Required.
Root string `json:"root"`
// Index file for serving a directory.
// Optional. Default value "index.html".
Index string `json:"index"`
// Enable HTML5 mode by forwarding all not-found requests to root so that
// SPA (single-page application) can handle the routing.
// Optional. Default value false.
HTML5 bool `json:"html5"`
// Enable directory browsing.
// Optional. Default value false.
Browse bool `json:"browse"`
}
StaticConfig defines the config for Static middleware.
Click to show internal directories.
Click to hide internal directories.