web

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileServer added in v1.1.0

func FileServer(root string) http.Handler

FileServer is a FileServerHandler with the NotFound handler set to http.NotFound.

func FileServerHandler added in v1.1.1

func FileServerHandler(root string, notFound http.HandlerFunc) http.Handler

FileServerHandler creates a file server that serves files from from a "Root" folder. It will call "NotFound" HandlerFunc if the file cannot be found on the system. In the event where the path is a directory, it will not redirect and instead call "NotFound" HandlerFunc.

Types

type Server

type Server struct {
	Addr    string        // TCP address to listen on, ":http" if empty
	Handler http.Handler  // handler to invoke, http.DefaultServeMux if nil
	Timeout time.Duration // Timeout to wait for shutdown
}

Server will create a http.Server from the Go standard library

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe mirrors the function from the Go standard library ListenAndServe always returns a non-nil error

Jump to

Keyboard shortcuts

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