variable / @typed/router

ServerRouter

Builds an SSR Router Layer from an in-memory history snapshot or initial URL.

Package version
1.0.0-beta.7
Category
Runtime providers
Since
1.0.0

Import

import { ServerRouter } from "@typed/router";

Signatures

export declare const ServerRouter: (options: MemoryOptions | InitialMemoryOptions) => Layer.Layer<Router, NavigationError>;

Why

Server rendering can run the exact matcher program without evaluating browser globals.

Ownership and lifetime

Layer acquisition owns memory history, random Uuid7State, and the root CurrentRoute until the Layer Scope closes. Identifier and navigation failures remain in NavigationError.

Examples

import * as Router from "@typed/router"

const RouterLive = Router.ServerRouter({ url: "https://example.com/products" })

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source