# matchedRoutes

**Kind:** Function

**Source:** [`src/helper/route/index.ts`](https://github.com/honojs/hono/blob/main/src/helper/route/index.ts#L32)

**Part of:** [Helper](subsystem-src-helper)

Get matched routes in the handler

`matchedRoutes` gets the routes that match a handler. Use it when route-aware code needs to inspect the handler’s current route matches before performing follow-up work.

## Signature

```ts
function matchedRoutes(c: Context): RouterRoute[]
```

## Parameters

| Name | Type |
|---|---|
| `c` | `Context` |

**Returns:** `RouterRoute[]`

## Diagram

```mermaid
graph LR
  Handler[Handler] --> MatchedRoutes[matchedRoutes]
  MatchedRoutes --> Routes[Matched routes]
  Routes --> Consumer[Route-aware logic]
```

## Usage

```ts
import { matchedRoutes } from './helper/route'

const routes = matchedRoutes(handler)

for (const route of routes) {
  console.log(route)
}
```

## AI Coding Instructions

- Pass the handler instance associated with the current request or execution context.
- Treat the returned routes as inspection data for route-aware behavior.
- Keep route matching logic centralized through `matchedRoutes` rather than duplicating handler traversal.
- Check the route shape before reading route-specific properties in downstream code.

## Relationships

- IMPORTS → `GET_MATCH_RESULT`
- IMPORTS → `getPattern`
- IMPORTS → `splitRoutingPath`

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (1)

- `handler` — `src/middleware/method-not-allowed/index.ts`:133
