# EndpointMetadata Class

Module
import { EndpointMetadata } from "@tsed/common"
Source/packages/common/src/mvc/models/EndpointMetadata.ts

# Overview

class EndpointMetadata extends Storable implements EndpointConstructorOptions {
    beforeMiddlewares: any[];
    middlewares: any[];
    afterMiddlewares: any[];
    pathsMethods: IPathMethod[];
    readonly responses: Map<number, IResponseOptions>;
    statusCode: number;
    readonly parent: EndpointMetadata | undefined;
    constructor(options: EndpointConstructorOptions);
    get type(): Type<any>;
    set type(type: Type<any>);
    get methodClassName(): string;
    get store(): Store;
    get params(): import("./ParamMetadata").ParamMetadata[];
    get response(): IResponseOptions;
    get(key: any): any;
    statusResponse(code: string | number): IResponseOptions;
    before(args: any[]): this;
    after(args: any[]): this;
    merge(args: any[]): this;
}

# Description

EndpointMetadata contains metadata about a controller and his method. Each annotation (@Get, @Body...) attached to a method are stored in a endpoint. EndpointMetadata convert this metadata to an array which contain arguments to call an Express method.

Example :

@Controller("/my-path") provide MyClass {

   @Get("/")
   @Authenticated()
   public myMethod(){}

}

# Members

beforeMiddlewares: any[]

middlewares: any[]

afterMiddlewares: any[]

pathsMethods: IPathMethod[]

Route strategy.


readonly responses: Map<number, IResponseOptions>

statusCode: number

readonly parent: EndpointMetadata | undefined

Endpoint inherited from parent class.


get type(): Type<any>

set type(type: Type<any>)

get methodClassName(): string

get store(): Store

get params(): import("./ParamMetadata").ParamMetadata[]

get response(): IResponseOptions

get(key: any): any

Find the a value at the controller level. Let this value be extended or overridden by the endpoint itself.


statusResponse(code: string | number): IResponseOptions

Change the type and the collection type from the status code.


before(args: any[]): this

after(args: any[]): this

merge(args: any[]): this

Store all arguments collected via Annotation.