Skip to content

ui-router-server / ui-router-server / createServerRouter

Function: createServerRouter()

ts
function createServerRouter(config): ServerRouter;

Defined in: index.ts:346

Compiles a mount table into a resolver. Every mount's routes and redirect table compile (and validate) at construction, whatever its strategy; a config with 'simulate' mounts also starts loading @uirouter/core here. The longest matching mount base owns a pathname outright — a verdict never falls through to a shorter mount.

A bare mount base ('/app', '/app/') resolves the empty subpath, which is notFound unless the mount supplies a root pattern — a rule like { pattern: /^/?$/, to: ... } or a url: '' route.

Parameters

ParameterType
config{ mounts: Record<string, MountConfig>; }
config.mountsRecord<string, MountConfig>

Returns

ServerRouter