Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InCtxMiddleware ¶
InCtxMiddleware allows to specify a key/value that should be set on each request context. This is useful for services that could be used by the handlers.
Types ¶
type Middleware ¶ added in v1.2.13
Middleware is a function that receives a http.Handler and returns a http.Handler that can be used to wrap the original handler with some functionality.
type Option ¶
type Option func(*mux)
Options for the server
type Router ¶ added in v1.2.13
type Router interface {
// Use allows to specify a middleware that should be executed for all the handlers
Use(middleware ...Middleware)
// Handle allows to register a new handler for a specific pattern
Handle(pattern string, handler http.Handler)
// HandleFunc allows to register a new handler function for a specific pattern
HandleFunc(pattern string, handler http.HandlerFunc)
// Folder allows to serve static files from a directory
Folder(prefix string, fs fs.FS)
// Group allows to create a new group of routes with a common prefix
Group(prefix string, fn func(Router))
}
Router is the interface that wraps the basic methods for a router
Click to show internal directories.
Click to hide internal directories.