summaryrefslogtreecommitdiff
path: root/server/main.ts
diff options
context:
space:
mode:
authorJoseph Ditton <jditton.atomic@gmail.com>2021-11-30 15:40:07 -0700
committerJoseph Ditton <jditton.atomic@gmail.com>2021-11-30 15:40:07 -0700
commit694f2318bd2eaf526d8714c56774022a15beae04 (patch)
treeedaed14ca7d7a52e8a7a8bcdb7483d1a34bd334a /server/main.ts
parent8d0b32f8dfe45291426e58f6bf20cffac8dab6e7 (diff)
downloadlocchat-694f2318bd2eaf526d8714c56774022a15beae04.tar.gz
locchat-694f2318bd2eaf526d8714c56774022a15beae04.zip
adds setup for roles
Diffstat (limited to 'server/main.ts')
-rw-r--r--server/main.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/main.ts b/server/main.ts
index b4f319b..a8dc0ae 100644
--- a/server/main.ts
+++ b/server/main.ts
@@ -1,14 +1,16 @@
import './env';
import * as fs from 'fs';
import { NestFactory } from '@nestjs/core';
+import { Logger } from '@nestjs/common';
import { join } from 'path';
import { NestExpressApplication } from '@nestjs/platform-express';
import * as cookieParser from 'cookie-parser';
import { AppModule } from './app.module';
+import * as morgan from 'morgan';
async function bootstrap() {
let httpsOptions;
- if (process.env.NODE_ENV === 'development') {
+ if (process.env.USE_SSL === 'true') {
httpsOptions = {
key: fs.readFileSync('./private-key.pem'),
cert: fs.readFileSync('./public-cert.pem'),
@@ -18,11 +20,18 @@ async function bootstrap() {
httpsOptions,
logger: ['verbose'],
});
-
app.use(cookieParser());
app.useStaticAssets(join(__dirname, '..', 'static'));
app.setBaseViewsDir(join(__dirname, '..', 'views'));
app.setViewEngine('hbs');
+ const logger = new Logger('Request');
+ app.use(
+ morgan('tiny', {
+ stream: {
+ write: (message) => logger.log(message.replace('\n', '')),
+ },
+ }),
+ );
await app.listen(process.env.PORT);
}
bootstrap();