diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -14,7 +14,7 @@ Gus is carefully structured as composable building blocks. The top-level package * a "Server" interface type * a "Handler" abstraction * a "Middleware" abstraction -* some useful Handler wrappers: filtering, falling through a list of handlers +* some useful Handler wrappers: a router, request filtering, falling through a list of handlers ## Protocols @@ -42,6 +42,16 @@ The gus/logging package provides everything you need to get a good basic start t * A request-logging middleware with common diagnostics (time, duration, url, status codes, response body lengths) * A simple constructor of useful default loggers at various levels. They output colorful logfmt lines to stdout. +## Routing + +The router in the gus package supports slash-delimited path pattern strings. In the segments of these patterns: + +* A "/:wildcard/" segment matches anything in that position, and captures the value as a route parameter. Or if the paramter name is omitted like "/:/", it matches anything in a single segment without capturing a paramter. +* A "/*remainder" segment is only allowed at the end and matches the rest of the path, capturing it into the paramter name. Or again, omitting a parameter name like "/*" simple matches any path suffix. +* Any other segment in the pattern must match the corresponding segment of a request exactly. + +Router also supports maintaining a list of middlewares at the router level, mounting sub-routers under a pattern, looking up the matching handler for any request, and of course acting as a Handler itself. + ## gus/contrib/* This is where useful building blocks themselves start to come in. Sub-packages of contrib include Handler and Middleware implementations which accomplish the things your servers actually need to do. |