# PlatformHandler Class platform

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

# Overview

class PlatformHandler {
    protected injector: InjectorService;
    constructor(injector: InjectorService);
    createHandlerMetadata(obj: any | EndpointMetadata): HandlerMetadata;
    /**
     * Create a native middleware based on the given metadata and return an instance of HandlerContext
     * @param metadata
     */
    createHandler(metadata: HandlerMetadata | any): any;
    /**
     * Get param from the context
     * @param param
     * @param context
     */
    getParam(param: ParamMetadata, context: HandlerContext): any;
    /**
     * Return a custom filter
     * @param param
     * @param context
     * @deprecated
     */
    getFilter(param: ParamMetadata, context: HandlerContext): any;
    mapHandlerContext(metadata: HandlerMetadata, { request, response, err, next }: any): HandlerContext;
    createRawHandler(metadata: HandlerMetadata): Function;
    protected onRequest(context: HandlerContext): Promise<void>;
/**
 *
 * @param metadata
 * @param context
 */

}

# Description

Platform Handler abstraction layer. Wrap original class method to a pure platform handler (Express, Koa, etc...).

# Members

protected injector: InjectorService;

createHandlerMetadata(obj: any | EndpointMetadata): HandlerMetadata;

createHandler(metadata: HandlerMetadata | any): any;

Create a native middleware based on the given metadata and return an instance of HandlerContext


getParam(param: ParamMetadata, context: HandlerContext): any;

Get param from the context


getFilter(param: ParamMetadata, context: HandlerContext): any;

Return a custom filter


mapHandlerContext(metadata: HandlerMetadata, { request, response, err, next }: any): HandlerContext;

createRawHandler(metadata: HandlerMetadata): Function;

protected onRequest(context: HandlerContext): Promise<void>;