-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (22 loc) · 714 Bytes
/
index.js
File metadata and controls
29 lines (22 loc) · 714 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
26
27
28
29
const { TraceEvents, trackRequires } = require("../../../index.cjs");
const { writeFileSync } = require('fs');
const traceEvents = new TraceEvents();
process.on("beforeExit", () => {
const events = traceEvents.getEvents();
traceEvents.destroy();
writeFileSync("events.json", JSON.stringify(events));
});
trackRequires(true, { trackSource: true });
// Express Hello world example
// Refs: https://expressjs.com/en/starter/hello-world.html
const express = require('express');
const app = express();
const port = 3000;
let server;
app.get('/', (req, res) => {
res.send('Hello World!');
server.close();
});
server = app.listen(port, () => {
console.log(`Example app listening on port ${port}`);
});