Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StaticConfig ¶
type StaticConfig struct {
// AssetsDir is the subdirectory within the embedded FS (e.g., "assets", "dist")
AssetsDir string
// SPAMode enables Single Page Application routing (serves index.html for non-file routes)
SPAMode bool
// DevMode disables static serving (for development when using dev server)
DevMode bool
// APIPrefix excludes paths starting with this prefix from static serving
APIPrefix string
}
StaticConfig configures static file serving behavior
type StaticResponse ¶
type StaticResponse struct {
StatusCode int
ContentType string
CacheControl string
Body []byte
NotFound bool
}
StaticResponse contains the result of static file processing
func ServeStaticFile ¶
func ServeStaticFile(assets embed.FS, config StaticConfig, path string) StaticResponse
ServeStaticFile is the core logic for serving static files, router-agnostic
Click to show internal directories.
Click to hide internal directories.