How 72sevenzy2/grouter works
Grouter is a Go HTTP router. Applications register routes and middleware, then pass the router to the standard HTTP server; incoming requests are matched against static or parameterized routes, wrapped in middleware, and dispatched to handlers with extracted parameters. The graph separates registration/grouping, matching and request context, and middleware integration. Middleware implementations live in a separately imported package; response behavior beyond the shown router code is not expanded. The README documents wildcard routes and middleware capabilities not all individually implemented in the excerpts.
Main entry points: router.go Router · handlers.go Route methods · group.go Route groups · group_handlers.go Group methods
Components 15
Route registration
- Route methods
grouter/handlers.go - Route groups
grouter/group.go - Group methods
grouter/group_handlers.go
Request routing
- Router
grouter/router.go - Route tables
core/types.go - Path matching
grouter/utils.go - Request parameters
core/types.go - HTML error pages
grouter/template.go
Middleware
- Middleware aliases
grouter/middleware_alias.go - Middleware chain
grouter/middleware_alias.go - Middleware package
Other components
- Application
- HTTP client
- Go HTTP server
- Application handler
Connections 17
- Application → Route methods: registers routes
README.md - Route methods → Router: delegates to
grouter/handlers.go - Application → Route groups: creates groups
README.md - Route groups → Group methods: registers routes
grouter/group.go - Group methods → Router: delegates to
- Router → Route tables: stores routes
grouter/router.go - Router → Go HTTP server: serves HTTP
README.md - HTTP client → Go HTTP server: sends requests
- Go HTTP server → Router: dispatches requests
README.md - Router → Route tables: looks up routes
grouter/router.go - Router → Path matching: matches dynamic paths
grouter/router.go - Router → Request parameters: builds context
grouter/router.go - Router → Application handler: dispatches handler
grouter/router.go - Application → Middleware aliases: configures middleware
README.md - Middleware aliases → Middleware package: wraps middleware
grouter/middleware_alias.go - Router → Middleware chain: applies middleware
grouter/router.go - Middleware chain → Application handler: wraps handler
grouter/middleware_alias.go