static

package
v0.0.0-...-4cbec95 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2017 License: MIT Imports: 6 Imported by: 5

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

func Static(root string) macross.Handler

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.

Jump to

Keyboard shortcuts

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