dist

package
v0.0.0-...-d500d3c Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(string) ([]byte, error)

Asset returns an error stating no assets were included in the binary.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns nil because there are no assets included in the binary.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo returns an error stating no assets were included in the binary.

Types

type BindataAssets

type BindataAssets struct {
	Prefix             string // Prefix is prepended to the http file request
	Default            string // Default is the file to serve if the file is not found
	DefaultContentType string // DefaultContentType is the content type of the default file
}

BindataAssets serves assets from go-bindata, but, also serves Default if assent doesn't exist This is to support single-page react-apps with its own router.

func (*BindataAssets) Handler

func (b *BindataAssets) Handler() http.Handler

Handler serves go-bindata using a go-bindata-assetfs façade

func (*BindataAssets) ServeHTTP

func (b *BindataAssets) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP wraps http.FileServer by returning a default asset if the asset doesn't exist. This supports single-page react-apps with its own built-in router. Additionally, we override the content-type if the Default file is used.

type DebugAssets

type DebugAssets struct {
	Dir     string // Dir is a directory location of asset files
	Default string // Default is the file to serve if file is not found.
}

DebugAssets serves assets via a specified directory

func (*DebugAssets) Handler

func (d *DebugAssets) Handler() http.Handler

Handler is an http.FileServer for the Dir

type Dir

type Dir struct {
	Default string
	// contains filtered or unexported fields
}

Dir functions like http.Dir except returns the content of a default file if not found.

func NewDir

func NewDir(dir, def string) Dir

NewDir constructs a Dir with a default file

func (Dir) Open

func (d Dir) Open(name string) (http.File, error)

Open will return the file in the dir if it exists, or, the Default file otherwise.

Jump to

Keyboard shortcuts

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