---
url: https://lit-ui-router.dev/api/ui-router-server/ssr/functions/settle.md
---
[ui-router-server](../../index.md) / [ssr](../index.md) / settle

# Function: settle()

```ts
function settle(
   router, 
   path, 
   options?
): Promise<Transition>;
```

Defined in: [ssr.ts:76](https://github.com/simshanith/lit-ui-router/blob/1cd954559604dabdcb4d0a419ac42b07b38f0fba/packages/ui-router-server/src/ssr.ts#L76)

Moves `router` to `path` and resolves once the transition the url starts
has landed, resolves included, so a synchronous render reads the router
after it.

It never starts the router, which happens once per router (`start()` on a
`UIRouterLit`, `urlService.listen()` on a core router): it sets the
url and syncs the router to it, whether or not the router is listening.
A page loop calls it once per path on the same router. A `redirectTo`
chain settles on its final state, and a path the router already stands on
resolves with the transition that brought it there.

A failed transition still reaches `stateService.defaultErrorHandler`,
which logs it unless replaced.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `router` | [`UIRouter`](https://ui-router.github.io/core/docs/latest/classes/_router_.uirouter.html) | the server router, its location installed with `installServerLocation` |
| `path` | `string` | the url to settle on, relative to the mount, query included |
| `options?` | [`SettleOptions`](../interfaces/SettleOptions.md) | how long to wait, and how many url rewrites to follow |

## Returns

`Promise`<[`Transition`](https://ui-router.github.io/core/docs/latest/classes/_transition_transition_.transition.html)>

the transition that landed

## Throws

an `Error` when no url rule matches `path` and the router declares no `otherwise`

## Throws

an `Error` whose `cause` is the transition's `Rejection` when it fails, a failed resolve's error in that rejection's `detail`

## Throws

an `Error` when nothing lands within [\`timeout\`](../interfaces/SettleOptions.md#timeout)

## Throws

an `Error` when url rules rewrite the url more than [\`maxRewrites\`](../interfaces/SettleOptions.md#maxrewrites) times

## Example

```ts
import { installServerLocation } from 'ui-router-server/location';
import { settle } from 'ui-router-server/ssr';

installServerLocation(router, { urlConfig: { strict: false } });

for (const path of ['/', '/sheet/7B']) {
  await settle(router, path);
  pages.set(path, render(router));
}
```
