fileserve

package
v0.0.0-...-891d2fd Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: BSD-3-Clause, BSD-3-Clause Imports: 3 Imported by: 0

README

file

GoDoc

This package defines a fileserving request handler, allowing to serve single files or whole directories.

Dependencies

These are the only two external dependencies required as they are necessary to take into account the execution context of a request-handling goroutine.

License

BSD 3-clause

Documentation

Overview

Package fileserve enables the serving of a static file or an entire directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server is an xhttp adapter of a net/http handler that serves the content of a named file or directory. For further information, please refer to https://golang.org/pkg/net/http/#ServeFile

func New

func New(path string) Server

NewServer returns a http request handler in charge of serving the content of a file or directory.

func (s Server) Link(nh xhttp.Handler) xhttp.HandlerLinker

Link registers a next request Handler to be called by ServeHTTP method. It returns the result of the linking.

func (Server) ServeHTTP

func (s Server) ServeHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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