|
1 | 1 | const SourcePlusPlus = require("sourceplusplus");
|
2 | 2 | SourcePlusPlus.start();
|
3 | 3 |
|
| 4 | +const axios = require("axios"); |
| 5 | +const express = require("express"); |
| 6 | + |
4 | 7 | const addBreakpoint = require("./command/add-breakpoint");
|
5 |
| -const executeIndicators = require("./indicator/indicator"); |
6 | 8 |
|
7 | 9 | function executeDemos() {
|
8 | 10 | addBreakpoint();
|
9 | 11 | executeIndicators();
|
10 | 12 | }
|
11 | 13 |
|
12 | 14 | 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