Documentation
¶
Overview ¶
Package handler provides the core HTTP file-serving handler and middleware composition for the static web server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildHandler ¶
BuildHandler composes the full middleware chain and returns a ready-to-use http.Handler. The chain is (outer to inner):
recovery → logging → security → headers (304 check) → compress → file handler
Types ¶
type FileHandler ¶
type FileHandler struct {
// contains filtered or unexported fields
}
FileHandler serves static files from disk with caching and compression support.
func NewFileHandler ¶
func NewFileHandler(cfg *config.Config, c *cache.Cache) *FileHandler
NewFileHandler creates a new FileHandler. absRoot is resolved via filepath.Abs so per-request path arithmetic is free of OS syscalls.
func (*FileHandler) ServeHTTP ¶
func (h *FileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles an HTTP request by resolving and serving the requested file.
Click to show internal directories.
Click to hide internal directories.