dist

package
v0.0.0-...-a385994 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: AGPL-3.0, AGPL-3.0-or-later Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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