bff.prefix

  • Type: string

  • Default: /api

CAUTION

Please use the new command in the root directory of the current project 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.