All files / examples/nestjs/src main.ts

0% Statements 0/21
100% Branches 1/1
100% Functions 1/1
0% Lines 0/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35                                                                     
/* eslint-disable @typescript-eslint/no-unused-vars */
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { HttpsEnabler } from '@https-enable/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import {
  FastifyAdapter,
  NestFastifyApplication,
} from '@nestjs/platform-fastify';
import {
  NestJsFastifyHttpsAdapter,
  NestJsExpressHttpsAdapter,
} from '@https-enable/adapter-nestjs';
 
async function bootstrap() {
  // const app = await NestFactory.create<NestExpressApplication>(AppModule);
  const app = await NestFactory.create<NestFastifyApplication>(
    AppModule,
    new FastifyAdapter(),
  );
 
  const adapter = new NestJsFastifyHttpsAdapter(app);
 
  const enabler = new HttpsEnabler({
    adapter,
    options: { host: '127.0.0.1', port: process.env.PORT ?? 3000 },
    certificateOptions: { validity: 1, domains: '127.0.0.1', base: 'cert' },
  });
 
  await enabler.startServer().then((res) => {
    console.log(`Server running in http://${res.host}:${res.port}`);
  });
}
void bootstrap();