webstatic

package module
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2020 License: MIT Imports: 3 Imported by: 2

README

webstatic

Go Report Card GoDoc

Web Static is the Go handler for handle static files, returns not found for directory

Usage

http.Handle("/-/", http.StripPrefix("/-", webstatic.Dir("assets")))

or

http.Handle("/-/", http.StripPrefix("/-", &webstatic.Handler{
    FileSystem: http.Dir("assets"),
    CacheControl: "public, max-age=3600",
}))

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	FileSystem   http.FileSystem
	CacheControl string
	Fallback     http.Handler
	// contains filtered or unexported fields
}

Handler serve static files

func Dir

func Dir(dir string) *Handler

Dir creates new handler with http.Dir

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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