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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
⌂ 换网址