> For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt.

# bff.prefix

- **类型：** `string`
- **默认值：** `/api`

:::tip
请先参考 [基础用法](/zh/guides/advanced-features/bff/function.md#启用-bff) 中的"启用 BFF"部分，完成 BFF 功能的启用。

:::

默认情况下，BFF API 目录下的路由访问前缀是 `/api`, 如下目录结构：

```bash
api
└── hello.ts
```

`api/hello.ts` 访问时对应的路由为 `localhost:8080/api/hello`。

该配置选项可以修改默认的路由前缀：

```ts title="modern.config.ts"
export default defineConfig({
  bff: {
    prefix: '/api-demo',
  },
});
```

对应的 `api/hello.ts` 访问路由为 `localhost:8080/api-demo/hello`。
