Documentation
¶
Overview ¶
Package route extracts HTTP endpoints from a Go project's source and maps each to the handler function that serves it. Each web framework has its own registration API, so detection is delegated to per-framework Extractors. The net/http extractor is the universal base.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Extractor ¶
type Extractor interface {
Name() string
// Match reports whether the package uses this framework (by imports).
Match(pkg *packages.Package) bool
// Extract walks the package syntax and returns its routes.
Extract(pkg *packages.Package) []Route
}
Extractor detects routes for a single framework.
type Route ¶
type Route struct {
Method string // GET/POST/... or "ANY"
Path string // URL path (best-effort; "" when dynamic/unknown)
Handler *types.Func // resolved handler func, or nil if unresolvable (e.g. inline closure)
Pos token.Pos // position of the route registration site (for click-to-source)
}
Route is one detected HTTP endpoint.
Click to show internal directories.
Click to hide internal directories.