http

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileServer

func FileServer(root http.FileSystem, config Config) http.Handler

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("/", http.FileServer(http.Dir("/tmp")))

As a special case, the returned file server redirects any request ending in "/index.html" to the same path, without the final "index.html".

Types

type Config

type Config struct {
	Path          string
	Host          string
	Port          string
	AddDelay      int
	Quiet         bool
	Cache         int
	NoIndex       bool
	Compression   bool
	IncludeHidden bool
	CORS          bool
	SSL           bool
	Cert          string
	Key           string

	Delay        time.Duration
	Address      string
	HasCache     bool
	FirstRequest bool
}

Config configure http server command.

func NewConfig

func NewConfig(c *cli.Context) (config Config)

NewConfig create config http server command.

type Server

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

Server implements the static http server.

func NewServer

func NewServer(config Config) *Server

NewServer return server implements the static http server.

func (*Server) GetHandler

func (s *Server) GetHandler() http.Handler

GetHandler http handler.

func (*Server) Run

func (s *Server) Run() error

Run command cli.

Jump to

Keyboard shortcuts

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