public

package
v1.14.6 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 10 Imported by: 67

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KnownPublicEntries = []string{
	"css",
	"fonts",
	"img",
	"js",
	"serviceworker.js",
	"vendor",
	"favicon.ico",
}

KnownPublicEntries list all direct children in the `public` directory

Functions

func Custom added in v1.1.0

func Custom(opts *Options) func(next http.Handler) http.Handler

Custom implements the static handler for serving custom assets.

func ServeContent added in v1.14.0

func ServeContent(w http.ResponseWriter, req *http.Request, fi os.FileInfo, modtime time.Time, content io.ReadSeeker)

ServeContent serve http content

func Static

func Static(opts *Options) func(next http.Handler) http.Handler

Static implements the static handler for serving assets.

func StaticHandler added in v1.5.0

func StaticHandler(dir string, opts *Options) func(next http.Handler) http.Handler

StaticHandler sets up a new middleware for serving static files in the

Types

type Options

type Options struct {
	Directory   string
	IndexFile   string
	SkipLogging bool
	FileSystem  http.FileSystem
	Prefix      string
}

Options represents the available options to configure the handler.

Jump to

Keyboard shortcuts

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