diff --git a/.changeset/fair-ants-work.md b/.changeset/fair-ants-work.md new file mode 100644 index 0000000000..ac3a105d52 --- /dev/null +++ b/.changeset/fair-ants-work.md @@ -0,0 +1,7 @@ +--- +'@backstage/backend-app-api': minor +--- + +**BREAKING**: The `httpRouterFactory` now accepts a `pathPrefix` option rather than `indexPlugin`. To set up custom index path, configure the new `rootHttpRouterFactory` with a custom `indexPath` instead. + +Added an implementation for the new `rootHttpRouterServiceRef`. diff --git a/.changeset/gorgeous-days-applaud.md b/.changeset/gorgeous-days-applaud.md new file mode 100644 index 0000000000..a34307d720 --- /dev/null +++ b/.changeset/gorgeous-days-applaud.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-plugin-api': patch +--- + +Added a new `rootHttpRouterServiceRef` and `RootHttpRouterService` interface. diff --git a/.changeset/tiny-cooks-hide.md b/.changeset/tiny-cooks-hide.md new file mode 100644 index 0000000000..feab4b65d2 --- /dev/null +++ b/.changeset/tiny-cooks-hide.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-defaults': patch +--- + +The new root HTTP router service is now installed by default. diff --git a/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts b/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts index 19108a00d9..d1c8643244 100644 --- a/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts +++ b/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts @@ -63,6 +63,9 @@ export const rootHttpRouterFactory = createServiceFactory({ return { use: (path: string, handler: Handler) => { + if (path.match(/^[/\s]*$/)) { + throw new Error(`Root router path may not be empty`); + } const conflictingPath = findConflictingPath(existingPaths, path); if (conflictingPath) { throw new Error(