-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathserver.mjs
More file actions
25 lines (19 loc) · 671 Bytes
/
server.mjs
File metadata and controls
25 lines (19 loc) · 671 Bytes
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
import express from 'express';
import cors from 'cors';
import * as Sentry from '@sentry/node';
import { startExpressServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests';
const app = express();
app.use(cors());
app.get('/keep', (_req, res) => {
res.send({ status: 'kept' });
setTimeout(() => {
// flush to avoid waiting for the span buffer timeout to send spans
// but defer it to the next tick to let the SDK finish the http.server span first.
Sentry.flush();
});
});
app.post('/drop', (_req, res) => {
res.send({ status: 'dropped' });
});
Sentry.setupExpressErrorHandler(app);
startExpressServerAndSendPortToRunner(app);