serve

package
v1.9.8 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(c Config) (http.Handler, error)

NewServer creates a new Server

func ShortenPath

func ShortenPath(s string) string

util functions

Types

type Config

type Config struct {
	Directory  string `type:"arg" help:"[directory] from which files will be served"`
	Auth       string `help:"Enable HTTP basic auth with the chosen username and password (must be in the form 'user:pass')"`
	LiveReload bool   `help:"Enable LiveReload, a websocket server which triggers browser refresh after each file change"`
	PushState  bool   `` /* 172-byte string literal not displayed */
	NoIndex    bool   `help:"Disable automatic loading of index.html"`
	NoSlash    bool   `help:"Disable automatic slash insertion when loading an index.html or directory"`
	NoList     bool   `help:"Disable directory listing"`
	NoArchive  bool   `` /* 130-byte string literal not displayed */
	NoCache    bool   `help:"Disable cache (file modified time is always now)"`
	Quiet      bool   `help:"Disable all output"`
	TimeFmt    string `help:"Set timestamp output format"`
	Fallback   string `help:"Requests that yeild a 404, will instead proxy through to the provided path (swaps in the appropriate Host header)"`
	Realm      string `help:"Set the realm for the authentication response"`
}

Config is a handler configuration

type Handler

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

Handler is custom file server

func (*Handler) ServeHTTP

func (s *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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