Documentation ¶
Overview ¶
Package fileserver provides a filesystem HTTP handler, based on the built-in Go FileServer. Extensions include better directory listings, support for injection, better and use of Context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileServer ¶
type FileServer struct { Version string Root http.FileSystem Inject inject.CopyInject Templates *template.Template NotFoundRoutes []routespec.RouteSpec Prefix string }
FileServer returns a handler that serves HTTP requests with the contents of the file system rooted at root.
To use the operating system's file system implementation, use http.Dir:
http.Handle("/", &fileserver.FileServer{Root: http.Dir("/tmp")})
func (*FileServer) ServeHTTP ¶
func (fserver *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*FileServer) ServeHTTPContext ¶
func (fserver *FileServer) ServeHTTPContext( ctx context.Context, w http.ResponseWriter, r *http.Request, )
ServeHTTPContext is like ServeHTTP, but with added context
Click to show internal directories.
Click to hide internal directories.