Register routes with app.get, app.post, app.put, app.patch, app.delete, and other supported verbs. Phase 1 supports exact paths, named parameters, and wildcard segments.
Exact routes
exact.ts
app.get("/health", (ctx) => ctx.ok({ status: "ok" }));Path parameters
params.ts
app.get("/users/:id", (ctx) => {
return ctx.json({ id: ctx.params.id });
});
app.get("/orgs/:orgId/users/:userId", (ctx) => {
return ctx.json({
orgId: ctx.params.orgId,
userId: ctx.params.userId,
});
});Wildcard routes
wildcard.ts
app.get("/docs/*", (ctx) => {
return ctx.json({ rest: ctx.params["*"] });
});404 and 405
- No matching route → 404 Not Found
- Route exists but HTTP method is not allowed → 405 Method Not Allowed
- 405 responses include an Allow header with supported methods for that path