Works on sentry config

parent 47905a41
import { Handlers } from '@sentry/node'; import { Handlers, init as sentryInit, Integrations } from '@sentry/node';
import * as bodyParser from 'body-parser'; import * as bodyParser from 'body-parser';
import * as compress from 'compression'; import * as compress from 'compression';
import * as cors from 'cors'; import * as cors from 'cors';
import * as express from 'express'; import * as express from 'express';
import { Request, Response, Router } from 'express'; import { Request, Response, Router } from 'express';
import * as logger from 'morgan'; import * as logger from 'morgan';
import * as process from 'process';
import { RoutingControllersOptions, useExpressServer } from 'routing-controllers'; import { RoutingControllersOptions, useExpressServer } from 'routing-controllers';
import * as swaggerUi from 'swagger-ui-express'; import * as swaggerUi from 'swagger-ui-express';
import options from './lib/cors.config'; import options from './lib/cors.config';
...@@ -53,6 +54,8 @@ class App { ...@@ -53,6 +54,8 @@ class App {
// Run configuration methods on the Express instance. // Run configuration methods on the Express instance.
constructor() { constructor() {
App.initializeSentry();
this._express = express(); this._express = express();
this._express.use(Handlers.requestHandler()); this._express.use(Handlers.requestHandler());
...@@ -90,6 +93,17 @@ class App { ...@@ -90,6 +93,17 @@ class App {
this._express.use(`${staticStatistics.routePrefix}/`, router); this._express.use(`${staticStatistics.routePrefix}/`, router);
} }
private static initializeSentry(): void {
sentryInit({
dsn: process.env.SENTRY_DSN,
integrations: [
new Integrations.OnUncaughtException(), new Integrations.OnUnhandledRejection(),
],
enabled: process.env.NODE_ENV === 'production',
debug: true,
});
}
} }
export default new App().express; export default new App().express;
declare function require(name: string): any; declare function require(name: string): any;
import { init as sentryInit, Integrations } from '@sentry/node';
import * as http from 'http'; import * as http from 'http';
import { Server } from 'http'; import { Server } from 'http';
import * as Minimist from 'minimist'; import * as Minimist from 'minimist';
...@@ -38,15 +37,6 @@ interface IInetAddress { ...@@ -38,15 +37,6 @@ interface IInetAddress {
address: string; address: string;
} }
sentryInit({
dsn: process.env.SENTRY_DSN,
integrations: [
new Integrations.OnUncaughtException(), new Integrations.OnUnhandledRejection(),
],
enabled: process.env.NODE_ENV === 'production',
debug: true,
});
(<IGlobal>global).DAO = { (<IGlobal>global).DAO = {
AssetDAO, AssetDAO,
CasDAO, CasDAO,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment