For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/configure/app/bff/prefix.md.
  • 简体中文
  • bff.prefix

    • 类型: string
    • 默认值: /api
    Tip

    请先参考 基础用法 中的"启用 BFF"部分,完成 BFF 功能的启用。

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

    api
    └── hello.ts

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

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

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

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