main.ts 612 B

12345678910111213141516171819202122
  1. import 'dotenv/config';
  2. import { NestFactory } from '@nestjs/core';
  3. import { AppModule } from './app.module';
  4. import * as fs from 'fs';
  5. import * as path from 'path';
  6. async function bootstrap() {
  7. const httpsOptions = {
  8. key: fs.readFileSync(path.resolve(__dirname, '../cert/127.0.0.1+1-key.pem')),
  9. cert: fs.readFileSync(path.resolve(__dirname, '../cert/127.0.0.1+1.pem')),
  10. };
  11. const app = await NestFactory.create(AppModule, { httpsOptions });
  12. app.enableCors({
  13. origin: 'https://192.168.100.100:4200',
  14. credentials: true,
  15. });
  16. await app.listen(process.env.PORT ?? 3000);
  17. }
  18. bootstrap();