diff options
author | Joseph Ditton <jditton.atomic@gmail.com> | 2021-11-03 19:25:40 -0600 |
---|---|---|
committer | Joseph Ditton <jditton.atomic@gmail.com> | 2021-11-03 19:25:40 -0600 |
commit | ceb7e5cf2c815f862b6b13a3c76d34a83655edef (patch) | |
tree | c1c913e32996935a67f9e8996aa5b569bdebba05 /src/main.ts | |
parent | 6dd39fcd58d7a5550a2f0cdac453f9964d0de6a4 (diff) | |
download | locchat-ceb7e5cf2c815f862b6b13a3c76d34a83655edef.tar.gz locchat-ceb7e5cf2c815f862b6b13a3c76d34a83655edef.zip |
update readme and adds ssl
Diffstat (limited to 'src/main.ts')
-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(); |