resolveChain
Resolves a matched chain, outermost route first.
Resolves a matched chain, outermost route first.
Import#
ts
import { resolveChain } from "@shadow-js/dusk/server";
Signature#
ts
function resolveChain(
routes: readonly ChainRoute[],
context: ChainContext,
onError: ChainErrorHandler,
): ResolvedChain | Promise<ResolvedChain>
Parameters#
| Name | Description |
|---|---|
routes |
The matched routes, outermost first (the root layout, then the page). |
context |
The raw query string, passed to the generator functions. |
onError |
Receives each error a metadata function threw; the layer then contributes nothing. |
Returns#
The merged result, or a promise of it when a generator function returned a promise.
Throws#
- TypeError (from
metadataBase) when the merged base is not an absolute http(s) URL.
Examples#
ts
const chain = resolveChain([root, page], { search: {} }, report);