#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bootstrap = void 0;
require("source-map-support/register");
const common_1 = require("@nestjs/common");
const core_1 = require("@nestjs/core");
const app_module_1 = require("./app.module");
const configure_middlewares_1 = require("./configure-middlewares");
const platform_ws_1 = require("@nestjs/platform-ws");
const config_service_1 = require("./config/config.service");
const path_1 = require("path");
process.on('unhandledRejection', (e) => {
    common_1.Logger.error('unhandledRejection: ' + e.message, e.stack);
});
process.on('uncaughtException', (e) => {
    common_1.Logger.error('uncaughtException: ' + e.message, e.stack);
});
async function bootstrap() {
    const { port, host } = new config_service_1.ConfigService().config;
    const app = await core_1.NestFactory.create(app_module_1.AppModule, {});
    app.useWebSocketAdapter(new platform_ws_1.WsAdapter(app));
    app.useStaticAssets(path_1.join(__dirname, '../public'));
    configure_middlewares_1.configureMiddlewares(app);
    app.enableShutdownHooks();
    await app.init();
    await app.listen(port, host);
    common_1.Logger.verbose(`Http server is listening ${await app.getUrl()} with NODE_ENV=${process.env.NODE_ENV}`, 'Server');
}
exports.bootstrap = bootstrap;
bootstrap();
//# sourceMappingURL=main.js.map