sites

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EmptyPrefix is the empty prefix for the key.
	EmptyPrefix = ""
	// DefaultIndexFile is the default index file to return if path is not found.
	DefaultIndexFile = "index.html"
)

Variables

This section is empty.

Functions

func New

func New(config ...Config) fiber.Handler

New creates a new middleware handler.

filesystem does not handle url encoded values (for example spaces) on it's own. If you need that functionality, set "UnescapePath" in fiber.Config.

Types

type Config

type Config struct {
	// Next defines a function to skip this middleware when returned true.
	//
	// Optional. Default: nil
	Next func(c fiber.Ctx) bool
	// Storage is the storage backend for the files.
	// This can be Azure Blob Storage, S3, or any other storage backend.
	Storage fiber.Storage
	// Prefix is a prefix for the key.
	Prefix string `json:"prefix"`
	// The value for the Cache-Control HTTP-header
	// that is set on the file response. MaxAge is defined in seconds.
	//
	// Optional. Default value 0.
	MaxAge int `json:"max_age"`
	// File to return if path is not found. Useful for SPA's.
	//
	// Optional. Default: ""
	NotFoundFile string `json:"not_found_file"`
	// The value for the Content-Type HTTP-header
	// that is set on the file response
	//
	// Optional. Default: ""
	ContentTypeCharset string `json:"content_type_charset"`
	// File that is served if the path is not a file.
	//
	// Optional. Default: "index.html"
	IndexFile string `json:"index_file"`
}

Config defines the config for middleware.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default config.

Jump to

Keyboard shortcuts

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