# ExpressApplication Decorator

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

# Overview

type ExpressApplication = Express.Application;
function ExpressApplication(target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number): any;

# Description

ExpressApplication is an alias type to the Express.Application interface. It use the util registerFactory() and let you to inject Express.Application created by the Server.

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

@Service()
export default class OtherService {
   constructor(@ExpressApplication expressApplication: Express.Application) {}
}
1
2
3
4
5
6

Note: TypeScript transform and store ExpressApplication as Function type in the metadata. So to inject a factory, you must use the @Inject(type) decorator.