server

package
v5.22.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressedJSONResponse added in v5.21.0

func CompressedJSONResponse(w http.ResponseWriter, statusCode int, data any)

CompressedJSONResponse writes a compressed JSON response with a status code.

func JSONFromRequest added in v5.21.0

func JSONFromRequest(r *http.Request, data any) error

JSONFromRequest extracts JSON content from the body of the request.

func JSONResponse added in v5.21.0

func JSONResponse(w http.ResponseWriter, statusCode int, data any)

JSONResponse writes a JSON response with a status code.

func Start added in v5.21.0

func Start(errorCallback func(error))

Start the server in the background. If the server is already running, nothing happens.

func Stop added in v5.21.0

func Stop()

Stop stops the server if it is running.

Types

type Dir added in v5.21.0

type Dir struct {
	Name  string   `json:"name"`
	Files []string `json:"files,omitempty"`
	Dirs  []*Dir   `json:"dirs,omitempty"`
}

Dir is a directory listing.

type Server

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

Server holds the embedded web server.

func (*Server) ServeHTTP

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

ServeHTTP implements the http.Handler interface.

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown shuts down the server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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