spa

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 8 Imported by: 0

README

spa

Allow embedding SPA in Go.

See: example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetInfo

type AssetInfo struct {
	Path     string
	Metadata map[string]string
}

type Assets

type Assets struct {
	Files          AssetsFS
	Statics        map[string]AssetInfo
	StaticsSenders []func(AssetInfo, http.ResponseWriter, *http.Request)
	Index          *template.Template
	IndexRenderer  func(string, map[string]template.HTML, http.ResponseWriter, *http.Request)
	// contains filtered or unexported fields
}

func NewAssets

func NewAssets(source fs.FS, sourcePrefix string, assets AssetsFS, opts ...AssetsOption) (*Assets, error)

func (*Assets) ServeHTTP

func (a *Assets) ServeHTTP(w http.ResponseWriter, r *http.Request)

type AssetsFS

type AssetsFS interface {
	fs.FS

	MkdirAll(string, fs.FileMode) error
	WriteFile(string, []byte, fs.FileMode) error
	Stat(name string) (os.FileInfo, error)
}

func NewInMem

func NewInMem() AssetsFS

func NewInMemAfero

func NewInMemAfero() AssetsFS

type AssetsOption

type AssetsOption func(*Assets) error

func WithPrefix

func WithPrefix(pattern, prefix string) AssetsOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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