Skip to content

Class: ServerFactory

Defined in: packages/microservices/src/transports/server.factory.ts:22

Factory that instantiates the correct transport server based on the provided MicroserviceOptions.

When the options object already implements CustomTransportStrategy (i.e. it has a listen function), it is returned as-is.

Constructors

Constructor

ts
new ServerFactory(): ServerFactory;

Returns

ServerFactory

Methods

create()

ts
static create(options): 
  | CustomTransportStrategy
  | Server;

Defined in: packages/microservices/src/transports/server.factory.ts:30

Creates and returns the appropriate transport server.

Parameters

ParameterTypeDescription
optionsMicroserviceOptionsEither a built-in transport configuration or a custom transport strategy instance.

Returns

| CustomTransportStrategy | Server

Throws

When options.transport is not a supported built-in transport.

Released under the MIT License.