Skip to content

Commit 69e7c01

Browse files
committed
chore: move indicators.js into main.js
1 parent 091b59c commit 69e7c01

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed

src/indicator/indicator.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/main.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
11
const SourcePlusPlus = require("sourceplusplus");
22
SourcePlusPlus.start();
33

4+
const axios = require("axios");
5+
const express = require("express");
6+
47
const addBreakpoint = require("./command/add-breakpoint");
5-
const executeIndicators = require("./indicator/indicator");
68

79
function executeDemos() {
810
addBreakpoint();
911
executeIndicators();
1012
}
1113

1214
setInterval(executeDemos, 1000);
15+
16+
function startIndicators() {
17+
const app = express();
18+
19+
app.use('/', require('./indicator/failing-endpoint'));
20+
app.use('/', require('./indicator/high-load-endpoint'));
21+
app.use('/', require('./indicator/slow-endpoint'));
22+
app.use('/', require('./indicator/unused-endpoint'));
23+
24+
app.listen(3000);
25+
}
26+
27+
startIndicators();
28+
29+
function executeIndicators() {
30+
//failing endpoint indicator
31+
axios.get('http://localhost:3000/indicator/fail-100-percent').catch(() => {});
32+
axios.get('http://localhost:3000/indicator/fail-50-percent').catch(() => {});
33+
34+
//slow endpoint indicator
35+
axios.get('http://localhost:3000/indicator/slow-2000ms').catch(() => {});
36+
axios.get('http://localhost:3000/indicator/slow-1000ms').catch(() => {});
37+
38+
//high load endpoint indicator
39+
axios.get('http://localhost:3000/indicator/high-load-four-per-second').catch(() => {});
40+
axios.get('http://localhost:3000/indicator/high-load-four-per-second').catch(() => {});
41+
axios.get('http://localhost:3000/indicator/high-load-four-per-second').catch(() => {});
42+
axios.get('http://localhost:3000/indicator/high-load-four-per-second').catch(() => {});
43+
axios.get('http://localhost:3000/indicator/high-load-two-per-second').catch(() => {});
44+
axios.get('http://localhost:3000/indicator/high-load-two-per-second').catch(() => {});
45+
}

0 commit comments

Comments
 (0)