# HttpServer Decorator

Module
import { HttpServer } from "@tsed/common"
Source/packages/common/src/server/decorators/httpServer.ts

# Overview

type HttpServer = Http.Server & IHttpFactory;
function HttpServer(target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number): any;

# Description

Inject the Http.Server instance.

# Example

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

@Service()
export default class OtherService {
   constructor(@HttpServer httpServer: HttpServer) {}
}
1
2
3
4
5
6

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