webapp

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MimeTypeTextCharset = "text/plain; charset=utf-8"
	MimeTypeHtmlCharset = "text/html; charset=utf-8"
	MimeTypeText        = "text/plain"
	MimeTypeBytes       = "application/octet-stream"
	MimeTypeHtml        = "text/html"
	MimeTypeAll         = "*/*"

	HeaderNameAccept      = "accept"
	HeaderNameContentType = "content-type"
	HeaderNameHXRequest   = "hx-request"
)

Variables

This section is empty.

Functions

func AddRoutes

func AddRoutes(mux *http.ServeMux, staticFilesPath string, ns uuid.UUID)

AddRoutes adds web routes to the given mux. If localStaticFiles is true, the webapp will serve static files from the local filesystem. Otherwise, it will serve them from the embedded filesystem.

func GetContentType

func GetContentType(h http.Header, defaultType string) (string, map[string]string, error)

GetContentType returns the mime type and the parameters from the given content type.

func GetResponseMimeType

func GetResponseMimeType(h http.Header, defaultType string, mimeTypes ...string) (string, error)

GetResponseMimeType returns the mime type to be used for the response.

func Index

func Index(ns uuid.UUID) http.Handler

Index returns a handler for the index page.

func MetricsHandler added in v1.14.6

func MetricsHandler(w http.ResponseWriter, _ *http.Request)

MetricsHandler is a HTTP handler that returns metrics from the ForNerds MetricsSet

func RequestLogHandler added in v1.16.0

func RequestLogHandler(h http.Handler) http.Handler

RequestLogHandler logs the request method and uri to stdout.

Types

This section is empty.

Jump to

Keyboard shortcuts

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