/** * This is not a production server yet! * This is only a minimal backend to get started. */ import { Logger } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; import { join } from 'path'; import { AppModule } from './app/app.module'; import { WsAdapter } from '@nestjs/platform-ws'; import { NestExpressApplication } from '@nestjs/platform-express'; import * as fs from 'fs'; async function bootstrap() { const keyFile = fs.readFileSync(__dirname + '/../../../localhost.key'); const certFile = fs.readFileSync(__dirname + '/../../../localhost.crt'); const app = await NestFactory.create(AppModule, { logger: true, cors: true, /*httpsOptions: { key: keyFile, cert: certFile, }*/ }); const globalPrefix = ''; app.setGlobalPrefix(globalPrefix); app.useStaticAssets(join(__dirname, '..', 'mt-client')); app.useWebSocketAdapter(new WsAdapter(app)); const port = 3000; await app.listen(port, () => { Logger.log('Listening at http://localhost:' + port + '/'); Logger.log(join(__dirname, '..', 'mt-client')); }); } bootstrap();