Router/handler.go
2025-04-26 11:12:58 -05:00

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)
}