Documentation
¶
Overview ¶
Package gocontroller wires providers and controllers into an existing router. It does not own the HTTP server, request context, or middleware runtime.
Index ¶
- Constants
- func Mount(adapter Adapter, root *Module) error
- type Adapter
- type Controller
- type ControllerMetadata
- type Module
- type Route
- func CONNECT(path string, handler any, middleware ...any) Route
- func DELETE(path string, handler any, middleware ...any) Route
- func GET(path string, handler any, middleware ...any) Route
- func HEAD(path string, handler any, middleware ...any) Route
- func OPTIONS(path string, handler any, middleware ...any) Route
- func PATCH(path string, handler any, middleware ...any) Route
- func POST(path string, handler any, middleware ...any) Route
- func PUT(path string, handler any, middleware ...any) Route
- func TRACE(path string, handler any, middleware ...any) Route
Constants ¶
const Version = "2.0.0"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
Adapter registers a complete batch of routes on a host router. Implementations must validate all handler and middleware types before registering any routes. Routing, request execution, and errors remain the host framework's concern.
type Controller ¶
type Controller interface {
ControllerMetadata() ControllerMetadata
}
Controller declares routes using bound native framework handler methods. Implement this directly or generate it from @Controller and @Get comments.
type ControllerMetadata ¶
type Module ¶
type Module struct {
Name string
Prefix string
Providers []any
Controllers []any
Imports []*Module
Middleware []any
}
Module groups controllers and providers. Imported prefixes and middleware nest beneath their parent. Providers are shared singletons within one Mount.