Middleware
Use middleware for shared request handling across paths.
app.middleware(() => new Response(null, { status: 204 }))app.middleware({ path: "/api" }, () => new Response("ok"))Middleware options
Section titled “Middleware options”| Field | Type | Description |
|---|---|---|
path | string | Optional path prefix. |
metadata | object | Extra middleware metadata. |
Middleware contributes route metadata to the backend app and runs in the Gateway runtime.