integrate sentry for error logging

This commit is contained in:
Amruth Pillai
2022-11-24 11:21:30 +01:00
parent 0672988fff
commit be0b7f20f9
19 changed files with 748 additions and 169 deletions

View File

@ -2,12 +2,14 @@ import { Logger, ValidationPipe } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import * as Sentry from '@sentry/node';
import cookieParser from 'cookie-parser';
import { AppModule } from './app.module';
const bootstrap = async () => {
const app = await NestFactory.create<NestExpressApplication>(AppModule);
const configService = app.get(ConfigService);
// Middleware
app.enableCors({ credentials: true });
@ -17,9 +19,11 @@ const bootstrap = async () => {
// Pipes
app.useGlobalPipes(new ValidationPipe({ transform: true }));
const configService = app.get(ConfigService);
const port = configService.get<number>('app.port');
// Error Logging
Sentry.init({ dsn: configService.get<string>('logging.sentryDSN') });
// Server Port
const port = configService.get<number>('app.port');
await app.listen(port);
Logger.log(`🚀 Server is up and running!`);