Route & request
Guide: Routing.
Route
| Member | Signature | Notes |
|---|---|---|
Route.init | (path: []const u8, render: fn (*Context) anyerror!*Node) Route | leaf route |
Route.layout | (path, render, children: []const Route) Route | nested; child paths relative |
.protect | (guard: fn (*Context) ?Redirect) Route | runs before render |
Path syntax: static segments, :name captures, trailing *rest wildcard. Nesting depth ≤ 8. Match chain renders leaf-first; layouts receive the child tree via ctx.outlet() (null ctx.outlet_node when the layout path itself matched).
Redirect
Redirect{ .to = "/login", .status = 303 } — returned from guards, or produced by ctx.redirect(to) / ctx.redirectWithStatus(to, status) during render.
Location
| Method | Notes |
|---|---|
Location.parse(url) | path/query/fragment view |
.queryGet(alloc, key) !?[]const u8 | decoded query param |
.isActive(href) bool | trailing-slash-normalized match |
RequestMeta
Request header snapshot: cookies (Cookie{ name, value }), Accept-Language, User-Agent, Method. Null outside live requests.
link
verve.link(ctx, "/counter", "Counter", .{ .prefetch_on_hover = true })Anchor the client runtime can intercept; LinkOpts controls prefetch behavior.