Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirectoryHandler ¶
func DirectoryHandler(dir string) (http.HandlerFunc, error)
DirectoryHandler produces an http handler function that can serve the contents of a specified directory. The handler will only serve files that have a matching mime type for their extension. The handler assumes that the path / translates to /index.html and that paths without an extension also map to the .html extension.
func LoadAllResources ¶
LoadAllResources recursively walks a directory searching for files that have a supported mime type for http and loads the contents. A URL path is generated from the path relative to the specified directory. The retuned map maps the generated URLs to the loaded resources.
Types ¶
type Resource ¶
A Resource is a file loaded from disk
func LoadResource ¶
LoadResource loads a Resource from a specified file path
func (*Resource) HandleRequest ¶
func (res *Resource) HandleRequest(w http.ResponseWriter, r *http.Request)
HandleRequest returns the resource for a given http GET or HEAD request