From ceb7e5cf2c815f862b6b13a3c76d34a83655edef Mon Sep 17 00:00:00 2001 From: Joseph Ditton Date: Wed, 3 Nov 2021 19:25:40 -0600 Subject: update readme and adds ssl --- src/main.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.ts b/src/main.ts index 90ecef4..4483c3b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,11 +1,21 @@ import { config } from 'dotenv'; +import * as fs from 'fs'; import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; config(); async function bootstrap() { - const app = await NestFactory.create(AppModule); + let httpsOptions; + if (process.env.NODE_ENV === 'development') { + httpsOptions = { + key: fs.readFileSync('./private-key.pem'), + cert: fs.readFileSync('./public-cert.pem'), + } + } + const app = await NestFactory.create(AppModule, { + httpsOptions + }); await app.listen(process.env.PORT); } bootstrap(); -- cgit v1.2.3-70-g09d2