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

# Function: matchRoute()

```ts
function matchRoute(routes, pathname): RouteMatch | null;
```

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

Returns which route's pattern the pathname matched, with the extracted
params. The most specific match wins ([compare](../../matcher/functions/compare.md)); ties go to
declaration order.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `routes` | [`CompiledRoute`](../interfaces/CompiledRoute.md)\[] |
| `pathname` | `string` |

## Returns

[`RouteMatch`](../interfaces/RouteMatch.md) | `null`
