1- import 'express-async-errors' ;
2-
3- // import * as Sentry from '@sentry/node';
41import compression from 'compression' ;
2+ import { configService , Cors , HttpServer } from './config/env.config' ;
53import cors from 'cors' ;
64import express , { json , NextFunction , Request , Response , urlencoded } from 'express' ;
75import { join } from 'path' ;
8-
9- import { configService , Cors , HttpServer } from './config/env.config' ;
106import { onUnexpectedError } from './config/error.config' ;
117import { Logger } from './config/logger.config' ;
128import { ROOT_DIR } from './config/path.config' ;
13- import { ServerUP } from './utils/server-up' ;
14- import { HttpStatus , router } from './whatsapp/routers/index.router' ;
159import { waMonitor } from './whatsapp/whatsapp.module' ;
10+ import { HttpStatus , router } from './whatsapp/routers/index.router' ;
11+ import 'express-async-errors' ;
12+ import { ServerUP } from './utils/server-up' ;
1613
1714function initWA ( ) {
1815 waMonitor . loadInstance ( ) ;
@@ -22,27 +19,6 @@ function bootstrap() {
2219 const logger = new Logger ( 'SERVER' ) ;
2320 const app = express ( ) ;
2421
25- // Sentry.init({
26- // dsn: '',
27- // integrations: [
28- // // enable HTTP calls tracing
29- // new Sentry.Integrations.Http({ tracing: true }),
30- // // enable Express.js middleware tracing
31- // new Sentry.Integrations.Express({ app }),
32- // // Automatically instrument Node.js libraries and frameworks
33- // ...Sentry.autoDiscoverNodePerformanceMonitoringIntegrations(),
34- // ],
35-
36- // // Set tracesSampleRate to 1.0 to capture 100%
37- // // of transactions for performance monitoring.
38- // // We recommend adjusting this value in production
39- // tracesSampleRate: 1.0,
40- // });
41-
42- // app.use(Sentry.Handlers.requestHandler());
43-
44- // app.use(Sentry.Handlers.tracingHandler());
45-
4622 app . use (
4723 cors ( {
4824 origin ( requestOrigin , callback ) {
@@ -67,18 +43,13 @@ function bootstrap() {
6743
6844 app . use ( '/' , router ) ;
6945
70- // app.use(Sentry.Handlers.errorHandler());
71-
72- // app.use(function onError(err, req, res, next) {
73- // res.statusCode = 500;
74- // res.end(res.sentry + '\n');
75- // });
76-
7746 app . use (
78- ( err : Error , req : Request , res : Response ) => {
47+ ( err : Error , req : Request , res : Response , next : NextFunction ) => {
7948 if ( err ) {
8049 return res . status ( err [ 'status' ] || 500 ) . json ( err ) ;
8150 }
51+
52+ next ( ) ;
8253 } ,
8354 ( req : Request , res : Response , next : NextFunction ) => {
8455 const { method, url } = req ;
0 commit comments