UNPKG

@tsed/common

Version:
48 lines (47 loc) 1.72 kB
import { InjectorService, TokenProvider } from "@tsed/di"; import { HandlerMetadata } from "../../mvc"; import { IRoute, IRouteController, IRouteDetails } from "../interfaces/IRoute"; import { PlatformApplication } from "./PlatformApplication"; import { PlatformHandler } from "./PlatformHandler"; import { PlatformRouter } from "./PlatformRouter"; /** * `Platform` is used to provide all routes collected by annotation `@Controller`. * * @platform */ export declare class Platform { readonly injector: InjectorService; readonly platformApplication: PlatformApplication; readonly platformHandler: PlatformHandler; private _routes; constructor(injector: InjectorService, platformApplication: PlatformApplication, platformHandler: PlatformHandler); get app(): PlatformApplication<TsED.Application, TsED.Router>; get routes(): IRouteController[]; /** * Create a native handler function based on the given handlerMetadata. * @param handler */ createHandler(handler: HandlerMetadata | any): Function; /** * Create routers from the collected controllers */ createRoutersFromControllers(): (import("..").PlatformRouterMethods<any> | undefined)[]; /** * Create a new instance of PlatformRouter * @param routerOptions */ createRouter(routerOptions?: any): PlatformRouter; addRoutes(routes: IRoute[]): void; addRoute(endpoint: string, token: TokenProvider): this; /** * Get all routes built by TsExpressDecorators and mounted on Express application. * @returns {IRouteDetails[]} */ getRoutes(): IRouteDetails[]; /** * * @param ctrl * @param endpointUrl */ private buildRoutes; }