# ExpressRouter Decorator

Module
import { ExpressRouter } from "@tsed/common"
Source/packages/common/src/platform-express/decorators/ExpressRouter.ts

# Overview

type ExpressRouter = Express.Router & {
    (target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number): any;
};
/**
 * Inject the ExpressRouter (Express.Router) instance.
 *
 * ### Example
 *
 * ```typescript
 * import {ExpressRouter, Service} from "@tsed/common";
 *
 * @Controller("/")
 * export default class OtherService {
 *    constructor(@ExpressRouter router: ExpressRouter) {}
 * }
 * ```
 *
 * @param {Type<any>} target
 * @param {string} targetKey
 * @param {TypedPropertyDescriptor<Function> | number} descriptor
 * @returns {any}
 * @decorator
 * @deprecated Use PlatformRouter instead of.
 */
function ExpressRouter(target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number): any;

# Description

Inject the ExpressRouter (Express.Router) instance.

# Example

import {ExpressRouter, Service} from "@tsed/common";

@Controller("/")
export default class OtherService {
   constructor(@ExpressRouter router: ExpressRouter) {}
}
1
2
3
4
5
6