app-backend: Deprecate createRouter

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2024-08-16 15:29:45 +02:00
parent cbec93aef0
commit 6bd6fdad12
3 changed files with 22 additions and 11 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-app-backend': patch
---
Deprecate `createRouter` and its options in favour of the new backend system.
+4 -4
View File
@@ -6,22 +6,22 @@
import { AuthService } from '@backstage/backend-plugin-api';
import { Config } from '@backstage/config';
import { ConfigSchema } from '@backstage/config-loader';
import { DatabaseService } from '@backstage/backend-plugin-api';
import express from 'express';
import { HttpAuthService } from '@backstage/backend-plugin-api';
import { LoggerService } from '@backstage/backend-plugin-api';
import { PluginDatabaseManager } from '@backstage/backend-common';
// @public (undocumented)
// @public @deprecated (undocumented)
export function createRouter(options: RouterOptions): Promise<express.Router>;
// @public (undocumented)
// @public @deprecated (undocumented)
export interface RouterOptions {
appPackageName: string;
// (undocumented)
auth?: AuthService;
// (undocumented)
config: Config;
database?: PluginDatabaseManager;
database?: DatabaseService;
disableConfigInjection?: boolean;
// (undocumented)
httpAuth?: HttpAuthService;
+13 -7
View File
@@ -14,11 +14,11 @@
* limitations under the License.
*/
import { notFoundHandler } from '@backstage/backend-common';
import {
notFoundHandler,
PluginDatabaseManager,
} from '@backstage/backend-common';
import { resolvePackagePath } from '@backstage/backend-plugin-api';
DatabaseService,
resolvePackagePath,
} from '@backstage/backend-plugin-api';
import { AppConfig, Config } from '@backstage/config';
import helmet from 'helmet';
import express from 'express';
@@ -47,7 +47,10 @@ import { AuthenticationError } from '@backstage/errors';
// express uses mime v1 while we only have types for mime v2
type Mime = { lookup(arg0: string): string };
/** @public */
/**
* @public
* @deprecated Please migrate to the new backend system as this will be removed in the future.
*/
export interface RouterOptions {
config: Config;
logger: LoggerService;
@@ -59,7 +62,7 @@ export interface RouterOptions {
*
* This is a built-in alternative to using a `staticFallbackHandler`.
*/
database?: PluginDatabaseManager;
database?: DatabaseService;
/**
* The name of the app package that content should be served from. The same app package should be
@@ -102,7 +105,10 @@ export interface RouterOptions {
schema?: ConfigSchema;
}
/** @public */
/**
* @public
* @deprecated Please migrate to the new backend system as this will be removed in the future.
*/
export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {