Documentation ¶
Index ¶
- func CacheControlHeaderHandler(w http.ResponseWriter, r *http.Request, info RoutingInfo, file fs.File)
- func ContentLengthHeaderHandler(w http.ResponseWriter, r *http.Request, info RoutingInfo, file fs.File)
- func ContentTypeHeaderHandler(w http.ResponseWriter, r *http.Request, info RoutingInfo, file fs.File)
- func ContentTypeOptionHeaderHandler(w http.ResponseWriter, r *http.Request, info RoutingInfo, file fs.File)
- func DefaultHeaderHandler(w http.ResponseWriter, r *http.Request, info RoutingInfo, file fs.File)
- func Must(err error)
- type FS
- type Handler
- type HeaderHandler
- type RouteHandler
- type Router
- type RoutingInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheControlHeaderHandler ¶
func CacheControlHeaderHandler(w http.ResponseWriter, r *http.Request, info RoutingInfo, file fs.File)
CacheControlHeaderHandler send cache control header of 7 days for the browser and 30 days for the CDN
func ContentLengthHeaderHandler ¶
func ContentLengthHeaderHandler(w http.ResponseWriter, r *http.Request, info RoutingInfo, file fs.File)
ContentLengthHeaderHandler sends the file size
func ContentTypeHeaderHandler ¶
func ContentTypeHeaderHandler(w http.ResponseWriter, r *http.Request, info RoutingInfo, file fs.File)
ContentTypeHeaderHandler sends content type based on the file name extension
func ContentTypeOptionHeaderHandler ¶
func ContentTypeOptionHeaderHandler(w http.ResponseWriter, r *http.Request, info RoutingInfo, file fs.File)
ContentTypeOptionHeaderHandler for nosniff content type option
func DefaultHeaderHandler ¶
func DefaultHeaderHandler(w http.ResponseWriter, r *http.Request, info RoutingInfo, file fs.File)
DefaultHeaderHandler is the default implementation for file headers
Types ¶
type FS ¶
type FS struct { StaticFiles *embed.FS FolderPrefix string UseLocalFolder bool LocalFolderPrefix string HeaderHeandler HeaderHandler }
FS file system for serving static content.
func (*FS) ServeHTTP ¶
func (fs *FS) ServeHTTP(w http.ResponseWriter, r *http.Request, info RoutingInfo)
type Handler ¶
type Handler interface {
ServeHTTP(http.ResponseWriter, *http.Request, RoutingInfo)
}
Handler interface that must be implemented by custom structs.
type HeaderHandler ¶
type HeaderHandler func(http.ResponseWriter, *http.Request, RoutingInfo, fs.File)
HeaderHandler for custom http header handling
type RouteHandler ¶
type RouteHandler func(http.ResponseWriter, *http.Request, RoutingInfo)
RouteHandler is the function construct called by this framework.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is the main struct for the whole routing logic.
func (*Router) HandleFunc ¶
func (router *Router) HandleFunc(method string, path string, handler RouteHandler) error
HandleFunc registers a new handler function using method and path for execution.
type RoutingInfo ¶
RoutingInfo is returned for each web server method call and includes details abount the execution.