static

package module
v0.0.0-...-5be0b41 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: MIT Imports: 10 Imported by: 0

README

Build Status codecov GoDoc Go Report Card

static

Static file server middleware for go route

Documentation

Index

Constants

View Source
const (
	KB
	MB
	GB
	TB
	PB
	EB
)

Variables

This section is empty.

Functions

func New

func New(options ...Option) route.MiddlewareFunc

New returns a Static middleware.

Types

type Option

type Option func(*Options)

func Browse

func Browse(browse bool) Option

func HTML5

func HTML5(html5 bool) Option

func Index

func Index(index string) Option

func Root

func Root(root string) Option

func Skipper

func Skipper(skipper route.Skipper) Option

type Options

type Options struct {
	// Skipper defines a function to skip middleware.
	Skipper route.Skipper

	// Root directory from where the static content is served.
	// Required.
	Root string `yaml:"root"`

	// Index file for serving a directory.
	// Optional. Default value "index.html".
	Index string `yaml:"index"`

	// Enable HTML5 mode by forwarding all not-found requests to root so that
	// SPA (single-page application) can handle the routing.
	// Optional. Default value false.
	HTML5 bool `yaml:"html5"`

	// Enable directory browsing.
	// Optional. Default value false.
	Browse bool `yaml:"browse"`
}

Options defines the config for Static middleware.

func GetDefaultOptions

func GetDefaultOptions() Options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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