mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
30 lines
1.5 KiB
JavaScript
30 lines
1.5 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const optional = require("optional");
|
|
const core_1 = require("@nestjs/core");
|
|
const microservices_package_not_found_exception_1 = require("@nestjs/core/errors/exceptions/microservices-package-not-found.exception");
|
|
const application_config_1 = require("@nestjs/core/application-config");
|
|
const express_factory_1 = require("@nestjs/core/adapters/express-factory");
|
|
const { NestMicroservice } = optional('@nestjs/microservices/nest-microservice') || {};
|
|
class TestingModule extends core_1.NestApplicationContext {
|
|
constructor(container, scope, contextModule) {
|
|
super(container, scope, contextModule);
|
|
}
|
|
<<<<<<< HEAD
|
|
createNestApplication(httpServer = express_factory_1.ExpressFactory.create()) {
|
|
return new core_1.NestApplication(this.container, httpServer, new application_config_1.ApplicationConfig());
|
|
=======
|
|
createNestApplication(expressInstance = express()) {
|
|
this.container.setApplicationRef(expressInstance);
|
|
return new core_1.NestApplication(this.container, expressInstance, new application_config_1.ApplicationConfig());
|
|
>>>>>>> master
|
|
}
|
|
createNestMicroservice(config) {
|
|
if (!NestMicroservice) {
|
|
throw new microservices_package_not_found_exception_1.MicroservicesPackageNotFoundException();
|
|
}
|
|
return new NestMicroservice(this.container, config, new application_config_1.ApplicationConfig());
|
|
}
|
|
}
|
|
exports.TestingModule = TestingModule;
|