# RequestContext Class

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

# Overview

class RequestContext extends Map<any, any> {
    /**
     * Request id generated by @@contextMiddleware@@.
     *
     * ::: tip
     * By default Ts.ED generate uuid like that `uuidv4().replace(/-/gi, ""))`.
     * Dash are removed to simplify tracking logs in Kibana
     * :::
     *
     * ::: tip
     * Request id can by customized by changing the server configuration.
     *
     * ```typescript
     * @ServerSettings({
     *   logger: {
     *     reqIdBuilder: createUniqId // give your own id generator function
     *   }
     * })
     * class Server {
     *
     * }
     * ```
     * :::
     *
     */
    readonly id: string;
    /**
     * Date when request have been handled by the server. @@RequestLogger@@ use this date to log request duration.
     */
    readonly dateStart: Date;
    /**
     * The request container used by the Ts.ED DI. It contain all services annotated with `@Scope(ProviderScope.REQUEST)`
     */
    container: LocalsContainer<any>;
    /**
     * The current @@EndpointMetadata@@ resolved by Ts.ED during the request.
     */
    endpoint: EndpointMetadata;
    /**
     * The data return by the previous endpoint if you use multiple handler on the same route. By default data is empty.
     */
    data: any;
    /**
     * Logger attached to the context request.
     */
    logger: RequestLogger;
    injector: InjectorService;
    constructor({ id, injector, logger, ...options }: IRequestContextOptions);
    destroy(): Promise<void>;
    emit(eventName: string, ...args: any[]): Promise<void>;
}