# baseRoutePath

**Kind:** Function

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

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

Get the basePath of the as-is route specified by routing.

`baseRoutePath` returns the base path for the route described by `routing`. Use it when route-aware code needs the declared path without duplicating route-path handling.

## Signature

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

## Parameters

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

**Returns:** `string`

## Diagram

```mermaid
graph LR
  A[Routing value] --> B[baseRoutePath]
  B --> C[Base route path]
```

## Usage

```ts
import { baseRoutePath } from '@/helper/route';

const routing = '/articles/[slug]';

const path = baseRoutePath(routing);

// Use the base route path in route-aware logic.
console.log(path);
```

## AI Coding Instructions

- Pass the routing value from the route configuration rather than rebuilding its path in calling code.
- Keep route parsing and base-path extraction inside `baseRoutePath`.
- Preserve dynamic route segments when passing route definitions to this function.
- Update callers if the routing value format changes.
