MCPcopy
hub / github.com/nestjs/nest / create

Method create

packages/core/nest-factory.ts:84–118  ·  view source on GitHub ↗
(
    moduleCls: IEntryNestModule,
    serverOrOptions?: AbstractHttpAdapter | NestApplicationOptions,
    options?: NestApplicationOptions,
  )

Source from the content-addressed store, hash-verified

82 options?: NestApplicationOptions,
83 ): Promise<T>;
84 public async create<T extends INestApplication = INestApplication>(
85 moduleCls: IEntryNestModule,
86 serverOrOptions?: AbstractHttpAdapter | NestApplicationOptions,
87 options?: NestApplicationOptions,
88 ): Promise<T> {
89 const [httpServer, appOptions] = this.isHttpServer(serverOrOptions!)
90 ? [serverOrOptions, options]
91 : [this.createHttpAdapter(), serverOrOptions];
92
93 const applicationConfig = new ApplicationConfig();
94 const container = new NestContainer(applicationConfig, appOptions);
95 const graphInspector = this.createGraphInspector(appOptions!, container);
96
97 this.setAbortOnError(serverOrOptions, options);
98 this.registerLoggerConfiguration(appOptions);
99
100 await this.initialize(
101 moduleCls,
102 container,
103 graphInspector,
104 applicationConfig,
105 appOptions,
106 httpServer,
107 );
108
109 const instance = new NestApplication(
110 container,
111 httpServer,
112 applicationConfig,
113 graphInspector,
114 appOptions,
115 );
116 const target = this.createNestInstance(instance);
117 return this.createAdapterProxy<T>(target, httpServer);
118 }
119
120 /**
121 * Creates an instance of NestMicroservice.

Callers

nothing calls this directly

Calls 8

isHttpServerMethod · 0.95
createHttpAdapterMethod · 0.95
createGraphInspectorMethod · 0.95
setAbortOnErrorMethod · 0.95
initializeMethod · 0.95
createNestInstanceMethod · 0.95
createAdapterProxyMethod · 0.95

Tested by

no test coverage detected