Skip to content

staticfs #

fn detect_content_type #

fn detect_content_type(file_path string) string

detect_content_type returns the MIME type for a file based on its extension

fn file_server #

fn file_server(config StaticConfig) http.HandlerFunc

file_server creates a static file handler

struct StaticConfig #

struct StaticConfig {
pub:
	root         string // Root directory for static files
	index_files  []string = ['index.html', 'index.htm'] // Default index files
	enable_index bool     = true                        // Enable directory index serving
	max_age      int // Cache-Control max-age in seconds (0 = no caching)
	enable_etag  bool = true // Enable ETag generation
}