rbasset

package module
v0.0.0-...-dbdc49b Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: MIT Imports: 7 Imported by: 0

README

Backlog

  • MUST support a static handler middleware
  • COULD add an helper to include static files with cach busting/sha validation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Dir              string `env:"RB_STATIC_DIR" envDefault:"."`
	StaticPathPrefix string `env:"RB_ASSET_STATIC_PATH_PREFIX" envDefault:"/static/"`
}

Conf configurest static file handler

func ParseConf

func ParseConf() (cfg Conf, err error)

ParseConf parses the env

type StaticFiles

type StaticFiles fs.FS

StaticFiles provides files for the static ware

func FromDir

func FromDir(logs *zap.Logger, cfg Conf) StaticFiles

FromDir provides template files from an actual directory

func FromEmbed

func FromEmbed(efs embed.FS) StaticFiles

FromEmbed creates a template files fs from an embedded filesystem

type StaticWare

type StaticWare func(http.Handler) http.Handler

StaticWare is middleware that shows static files for a certain prefix

func NewStatic

func NewStatic(logs *zap.Logger, cfg Conf, sfs StaticFiles) StaticWare

NewStatic returns a static file handler configured on the prefix

Jump to

Keyboard shortcuts

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