Route & request

Guide: Routing.

Route

MemberSignatureNotes
Route.init(path: []const u8, render: fn (*Context) anyerror!*Node) Routeleaf route
Route.layout(path, render, children: []const Route) Routenested; child paths relative
.protect(guard: fn (*Context) ?Redirect) Routeruns 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

MethodNotes
Location.parse(url)path/query/fragment view
.queryGet(alloc, key) !?[]const u8decoded query param
.isActive(href) booltrailing-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.