Documentation ¶
Overview ¶
Package web provides a web server with some standardized logging and handler wrapping.
Index ¶
Constants ¶
const ( ProtocolHTTP = "http" ProtocolHTTPS = "https" )
Constants for protocols the server can provide.
Variables ¶
This section is empty.
Functions ¶
func HasMorePathSegments ¶
HasMorePathSegments returns true if more path segments will be returned from future calls to PathHeadThenShift() for the request.
func LastPathHead ¶
LastPathHead returns the last result obtained from a call to PathHeadThenShift() for the request.
func PathHeadThenShift ¶
PathHeadThenShift returns the head segment of the request's adjusted path, then shifts it left by one segment. This does not adjust the path stored in req.URL.Path.
func RemainingPath ¶
RemainingPath returns the remaining path for a request.
Types ¶
type Server ¶
type Server struct { CertFile string KeyFile string ShutdownGracePeriod time.Duration Logger *slog.Logger WebServer *http.Server Ports []int ShutdownCallback func() StartedChan chan any // If not nil, will be closed once the server is ready to accept connections // contains filtered or unexported fields }
Server holds the data necessary for the server.
func (*Server) LocalBaseURL ¶
LocalBaseURL returns the local base URL that will reach the server.