# 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;
<span class="token keyword">constructor</span><span class="token punctuation">(</span>injector<span class="token punctuation">:</span> <a href="/api/di/services/InjectorService.html"><span class="token">InjectorService</span></a><span class="token punctuation">,</span> platformApplication<span class="token punctuation">:</span> <a href="/api/common/platform/services/PlatformApplication.html"><span class="token">PlatformApplication</span></a><span class="token punctuation">,</span> platformHandler<span class="token punctuation">:</span> <a href="/api/common/platform/services/PlatformHandler.html"><span class="token">PlatformHandler</span></a><span class="token punctuation">)</span><span class="token punctuation">;</span>
get <span class="token function">app</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/common/platform/services/PlatformApplication.html"><span class="token">PlatformApplication</span></a><span class="token punctuation">;</span>
get <span class="token function">routes</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/common/platform/interfaces/IRouteController.html"><span class="token">IRouteController</span></a><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
/**
 * Create a native metadata base on the metadata or to the given Class.
 * @param handler
 */
<span class="token function">createHandler</span><span class="token punctuation">(</span>handler<span class="token punctuation">:</span> <a href="/api/common/mvc/models/HandlerMetadata.html"><span class="token">HandlerMetadata</span></a> | <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>
/**
 * Create routers <span class="token keyword">from</span> the collected controllers
 */
<span class="token function">createRoutersFromControllers</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token punctuation">(</span><span class="token keyword">import</span><span class="token punctuation">(</span>".."<span class="token punctuation">)</span>.<a href="/api/common/platform/interfaces/IPlatformDriver.html"><span class="token">IPlatformDriver</span></a>&lt;<span class="token keyword">any</span>&gt; | undefined<span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
/**
 * Create a new instance of <a href="/api/common/platform/services/PlatformRouter.html"><span class="token">PlatformRouter</span></a>
 * @param routerOptions
 */
<span class="token function">createRouter</span><span class="token punctuation">(</span>routerOptions?<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/common/platform/services/PlatformRouter.html"><span class="token">PlatformRouter</span></a><span class="token punctuation">;</span>
<span class="token function">addRoutes</span><span class="token punctuation">(</span>routes<span class="token punctuation">:</span> <a href="/api/common/platform/interfaces/IRoute.html"><span class="token">IRoute</span></a><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">void</span><span class="token punctuation">;</span>
<span class="token function">addRoute</span><span class="token punctuation">(</span>endpoint<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">,</span> token<span class="token punctuation">:</span> <a href="/api/di/interfaces/TokenProvider.html"><span class="token">TokenProvider</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> this<span class="token punctuation">;</span>
/**
 * <a href="/api/common/mvc/decorators/method/Get.html"><span class="token">Get</span></a> all routes built by TsExpressDecorators and mounted on Express application.
 * @returns <span class="token punctuation">{</span><a href="/api/common/platform/interfaces/IRouteDetails.html"><span class="token">IRouteDetails</span></a><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">}</span>
 */
<span class="token function">getRoutes</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/common/platform/interfaces/IRouteDetails.html"><span class="token">IRouteDetails</span></a><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
/**
 *
 * @param ctrl
 * @param endpointUrl
 */

}

# Description

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