Skip to content

Commit 091b59c

Browse files
committed
chore: cleanup
1 parent e2c7aa7 commit 091b59c

File tree

2 files changed

+30
-41
lines changed

2 files changed

+30
-41
lines changed

src/indicator/indicator.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const axios = require("axios");
2+
3+
const express = require('express');
4+
const app = express();
5+
6+
app.use('/', require('./failing-endpoint'));
7+
app.use('/', require('./high-load-endpoint'));
8+
app.use('/', require('./slow-endpoint'));
9+
app.use('/', require('./unused-endpoint'));
10+
11+
app.listen(3000);
12+
13+
module.exports = function () {
14+
//failing endpoint indicator
15+
axios.get('http://localhost:3000/indicator/fail-100-percent').catch(() => {});
16+
axios.get('http://localhost:3000/indicator/fail-50-percent').catch(() => {});
17+
18+
//slow endpoint indicator
19+
axios.get('http://localhost:3000/indicator/slow-2000ms').catch(() => {});
20+
axios.get('http://localhost:3000/indicator/slow-1000ms').catch(() => {});
21+
22+
//high load endpoint indicator
23+
axios.get('http://localhost:3000/indicator/high-load-four-per-second').catch(() => {});
24+
axios.get('http://localhost:3000/indicator/high-load-four-per-second').catch(() => {});
25+
axios.get('http://localhost:3000/indicator/high-load-four-per-second').catch(() => {});
26+
axios.get('http://localhost:3000/indicator/high-load-four-per-second').catch(() => {});
27+
axios.get('http://localhost:3000/indicator/high-load-two-per-second').catch(() => {});
28+
axios.get('http://localhost:3000/indicator/high-load-two-per-second').catch(() => {});
29+
}

src/main.js

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,11 @@ const SourcePlusPlus = require("sourceplusplus");
22
SourcePlusPlus.start();
33

44
const addBreakpoint = require("./command/add-breakpoint");
5+
const executeIndicators = require("./indicator/indicator");
56

67
function executeDemos() {
78
addBreakpoint();
89
executeIndicators();
910
}
1011

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

0 commit comments

Comments
 (0)