Merge pull request #15462 from backstage/mob/root-http-router
backend-next: introduce new root http router service
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Handler } from 'express';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface RootHttpRouterService {
|
||||
/**
|
||||
* Registers a handler at the root of the backend router.
|
||||
* The path is required and may not be empty.
|
||||
*/
|
||||
use(path: string, handler: Handler): void;
|
||||
}
|
||||
@@ -103,6 +103,15 @@ export namespace coreServices {
|
||||
import('./PluginMetadataService').PluginMetadataService
|
||||
>({ id: 'core.pluginMetadata' });
|
||||
|
||||
/**
|
||||
* The service reference for the root scoped {@link RootHttpRouterService}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const rootHttpRouter = createServiceRef<
|
||||
import('./RootHttpRouterService').RootHttpRouterService
|
||||
>({ id: 'core.rootHttpRouter', scope: 'root' });
|
||||
|
||||
/**
|
||||
* The service reference for the root scoped {@link RootLifecycleService}.
|
||||
*
|
||||
|
||||
@@ -27,6 +27,7 @@ export type {
|
||||
export type { LoggerService, LogMeta } from './LoggerService';
|
||||
export type { PermissionsService } from './PermissionsService';
|
||||
export type { PluginMetadataService } from './PluginMetadataService';
|
||||
export type { RootHttpRouterService } from './RootHttpRouterService';
|
||||
export type { RootLifecycleService } from './RootLifecycleService';
|
||||
export type { RootLoggerService } from './RootLoggerService';
|
||||
export type { SchedulerService } from './SchedulerService';
|
||||
|
||||
Reference in New Issue
Block a user