diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.ts | 12 |
1 files changed, 11 insertions, 1 deletions
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(); |