bff.prefix

  • Type: string
  • Default: /api
Tip

Please refer to the Enable BFF section in Basic Usage to enable BFF functionality first.

By default, the prefix for accessing routes in the BFF API directory is /api, as shown in the following directory structure:

api
└── hello.ts

The route corresponding to api/hello.ts when accessed is localhost:8080/api/hello.

This configuration option can modify the default route prefix:

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

The corresponding route for api/hello.ts when accessed is localhost:8080/api-demo/hello.