# routePath

**Kind:** Function

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

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

Get the route path registered within the handler

`routePath` reads the route path associated with a registered handler. Use it when middleware, diagnostics, or route-aware code needs the path stored on a handler instead of rebuilding it from request data.

## Signature

```ts
function routePath(c: Context, index: number): string
```

## Parameters

| Name | Type |
|---|---|
| `c` | `Context` |
| `index` | `number` |

**Returns:** `string`

## Diagram

```mermaid
graph LR
  Handler[Registered handler] --> RoutePath[routePath]
  RoutePath --> Path[Registered route path]
```

## Usage

```ts
import { routePath } from './helper/route';

const registeredPath = routePath(userHandler);

console.log(`Handler is registered for: ${registeredPath}`);
```

## AI Coding Instructions

- Call `routePath` with the handler that was registered with the router.
- Keep route metadata attached to the handler when wrapping or composing handlers.
- Do not derive the registered path from the incoming request when handler metadata is available.
- Use the returned path for logging, diagnostics, or route-aware middleware behavior.
