18 lines
448 B
Go
18 lines
448 B
Go
package router
|
|
|
|
// Handler is an interface for handling HTTP requests with path parameters.
|
|
type Handler interface {
|
|
Serve(params []string)
|
|
}
|
|
|
|
// Middleware wraps a handler with additional functionality.
|
|
type Middleware func(Handler) Handler
|
|
|
|
// FuncHandler is a function that implements the Handler interface.
|
|
type FuncHandler func(params []string)
|
|
|
|
// Serve calls the handler function.
|
|
func (f FuncHandler) Serve(params []string) {
|
|
f(params)
|
|
}
|