---
url: >-
  https://lit-ui-router.dev/reference/ui-router-server/simulate/functions/createHeadlessRouter.md
---
[ui-router-server](../../index.md) / [simulate](../index.md) / createHeadlessRouter

# Function: createHeadlessRouter()

```ts
function createHeadlessRouter(states, config?): UIRouter;
```

Defined in: [simulate.ts:17](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/simulate.ts#L17)

Core's own headless recipe: vanilla $q/$injector plus an in-memory location
need no DOM, so per-request instantiation is workerd-safe.

Registers a shallow copy of each declaration, so one array can back many
concurrent routers. Inside a declaration's own functions (`redirectTo`,
resolves, hooks), `transition.to()` and `state.self` are the copy, not the
caller's object; compare states by `name`.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `states` | readonly [`StateDeclaration`](https://ui-router.github.io/core/docs/latest/interfaces/_state_interface_.statedeclaration.html)\[] |
| `config?` | [`RouterUrlConfig`](../../url-config/interfaces/RouterUrlConfig.md) |

## Returns

[`UIRouter`](https://ui-router.github.io/core/docs/latest/classes/_router_.uirouter.html)
