From 96854d4bf78a27f2732812d4af6c469f5b875fc1 Mon Sep 17 00:00:00 2001 From: XiaoLin Date: Wed, 29 Apr 2020 13:38:29 +0800 Subject: [PATCH] feat: Sentry error tracking --- src/api/init.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/api/init.js b/src/api/init.js index e753790..726194e 100644 --- a/src/api/init.js +++ b/src/api/init.js @@ -6,9 +6,17 @@ const cookieParser = require('cookie-parser') const user = require('./../module/user') const config = require('./../module/config') const cache = require('./../module/cache') +const Sentry = require('@sentry/node') const pathPrefix = config.get('system.path') +Sentry.init({ + dsn: 'https://a5df6f6888404ec492be93b7e93b5dd3@o230009.ingest.sentry.io/5217379' +}) + +app.use(Sentry.Handlers.requestHandler()) +app.use(Sentry.Handlers.errorHandler()) + app.use(cookieParser()) app.use(bodyParser.json())