-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
33 lines (25 loc) · 859 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const express = require("express");
const Sentry = require("@sentry/node");
const Tracing = require("@sentry/tracing");
const test = require("./routes/test.js");
const app = express();
Sentry.init({
dsn: "https://b279026002e847d6a0a18821bbe92190@o1079854.ingest.sentry.io/6085014",
integrations: [
new Sentry.Integrations.Http({ tracing: true }),
new Tracing.Integrations.Express({ app }),
],
tracesSampleRate: 1.0,
});
app.use(Sentry.Handlers.requestHandler());
app.use(Sentry.Handlers.tracingHandler());
app.use("/test", test);
app.get("/debug-sentry", function mainHandler(req, res) {
throw new Error("My first Sentry error!");
});
app.use(Sentry.Handlers.errorHandler());
app.use(function onError(err, req, res, next) {
res.statusCode = 500;
res.end(res.sentry + "\n");
});
app.listen(3000);