-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathserver.js
39 lines (29 loc) · 1.07 KB
/
server.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
34
35
36
37
38
39
const { loggingTransport, startExpressServerAndSendPortToRunner } = require('@sentry-internal/node-integration-tests');
const Sentry = require('@sentry/node');
const cors = require('cors');
Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0',
// disable attaching headers to /test/* endpoints
tracePropagationTargets: [/^(?!.*test).*$/],
tracesSampleRate: 1.0,
transport: loggingTransport,
});
// express must be required after Sentry is initialized
const express = require('express');
const app = express();
app.use(cors());
app.get('/test/express', (_req, res) => {
res.send({ response: 'response 1' });
});
app.get(/\/test\/regex/, (_req, res) => {
res.send({ response: 'response 2' });
});
app.get(['/test/array1', /\/test\/array[2-9]/], (_req, res) => {
res.send({ response: 'response 3' });
});
app.get(['/test/arr/:id', /\/test\/arr[0-9]*\/required(path)?(\/optionalPath)?\/(lastParam)?/], (_req, res) => {
res.send({ response: 'response 4' });
});
Sentry.setupExpressErrorHandler(app);
startExpressServerAndSendPortToRunner(app);