serve: github.com/syntaqx/serve Index | Files | Directories

package serve

import "github.com/syntaqx/serve"

Package serve provides a static http server anywhere you need one.

Index

Package Files

serve.go

type FileServer Uses

type FileServer struct {
    // contains filtered or unexported fields
}

FileServer wraps an http.FileServer.

func NewFileServer Uses

func NewFileServer(options ...Options) *FileServer

NewFileServer initializes a FileServer.

func (*FileServer) ServeHTTP Uses

func (fs *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the net/http.Handler interface.

func (*FileServer) Use Uses

func (fs *FileServer) Use(mws ...func(http.Handler) http.Handler)

Use wraps the Handler with middleware(s).

type Options Uses

type Options struct {
    // Directory is the root directory from which to serve files.
    Directory string

    // Prefix is a filepath prefix that should be ignored by the FileServer.
    Prefix string
}

Options is a struct for specifying configuration options for a FileServer.

Directories

PathSynopsis
internal/commands
internal/config
internal/middleware
mock

Package serve imports 1 packages (graph) and is imported by 1 packages. Updated 2019-01-29. Refresh now. Tools for package owners.