# Platform Service

Module
import { Platform } from "@tsed/common"
Source/packages/common/src/platform/services/Platform.ts

# Overview

class Platform {
    readonly injector: InjectorService;
    readonly platformApplication: PlatformApplication;
    readonly platformHandler: PlatformHandler;
    readonly routers: any[];
    constructor(injector: InjectorService, platformApplication: PlatformApplication, platformHandler: PlatformHandler);
    get app(): PlatformApplication;
    get routes(): IRouteController[];
    createHandler(handler: HandlerMetadata | any): any;
    createRoutersFromControllers(): (import("..").IPlatformDriver<any> | undefined)[];
    createRouter(routerOptions?: any): PlatformRouter;
    addRoutes(routes: IRoute[]): void;
    addRoute(endpoint: string, token: TokenProvider): this;
    getRoutes(): IRouteDetails[];
}

# Description

Platform is used to provide all routes collected by annotation @Controller.

# Members

readonly injector: InjectorService

readonly platformApplication: PlatformApplication

readonly platformHandler: PlatformHandler

readonly routers: any[]


get routes(): IRouteController[]

createHandler(handler: HandlerMetadata | any): any

Create a native metadata base on the metadata or to the given Class.


createRoutersFromControllers(): (import("..").IPlatformDriver<any> | undefined)[]

Create routers from the collected controllers


createRouter(routerOptions?: any): PlatformRouter

Create a new instance of PlatformRouter


addRoutes(routes: IRoute[]): void

addRoute(endpoint: string, token: TokenProvider): this

getRoutes(): IRouteDetails[]

Get all routes built by TsExpressDecorators and mounted on Express application.