Documentation ¶
Overview ¶
Package static provides middleware for the Chi router to serve static files. This package allows detailed configuration including the static file prefix and the root directory for static files. It supports both real file systems and embedded file systems.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Fs fs.FS Root string FilePrefix string CacheDuration time.Duration Debug bool Logger Logger }
Config struct defines the configuration for the static file serving middleware. Fs refers to the file system (which can be embedded) containing the static files. Root specifies the root directory within the file system for the static files. FilePrefix is the URL prefix used to serve static files. CacheDuration is the duration for which the static files are cached.
The Debug flag enables additional logging for troubleshooting, and Logger is an interface for a custom logging mechanism. If Logger is nil and Debug is true, a default logger is used.