fileserver

package
v0.0.0-...-e5f94df Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2016 License: MIT, BSD-3-Clause Imports: 14 Imported by: 0

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 {
	Root      http.FileSystem
	Inject    inject.CopyInject
	Templates *template.Template
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL