ui-router-server / ui-router-server / ServerRouter
Interface: ServerRouter<Decls>
Defined in: index.ts:289
The compiled resolver createServerRouter returns: a pathname in, a Verdict out. Decls is the union of the route declarations it was built from, inferred from as const routes; the fetch adapter reads its delegate keys and state names. Untyped routes keep the default, RouteDeclaration, under which keys and names are string.
Type Parameters
| Type Parameter | Default type |
|---|---|
Decls extends RouteDeclaration | RouteDeclaration |
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
[routeDeclarations]? | readonly | Decls | Type-only: carries Decls; never set at runtime. | index.ts:311 |
base? | readonly | string | The url path the site is served at, from createServerRouter({ base }), with one trailing slash. The adapters, serverRouterPlugin and prerender default their own base to it. | index.ts:309 |
Methods
resolve()
resolve(pathnameOrUrl): Promise<Verdict>;Defined in: index.ts:303
Accepts a pathname, an absolute url string, or anything with a pathname (URL, Location). Under a base, the pathname lies under it, with the base taken off, as the adapters hand it over; verdict mounts and redirect locations come back the same way.
A path that begins with // below its mount is answered from its collapsed spelling, so no state matches it with an empty leading param: a 302 to that spelling, the redirect that spelling itself answers, or notFound when it matches no route.
Parameters
| Parameter | Type |
|---|---|
pathnameOrUrl | | string | { pathname: string; } |
Returns
Promise<Verdict>