---
url: >-
  https://lit-ui-router.dev/v1/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:287

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`
