-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (26 loc) · 745 Bytes
/
index.js
File metadata and controls
30 lines (26 loc) · 745 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
30
const express = require('express');
const gci = require('./gcinterceptor');
const app = express();
const PORT = process.env.PORT || 3000;
const USE_GCI = process.env.USE_GCI || 'FALSE';
const MSG_SIZE = process.env.MSG_SIZE || 1024;
const WINDOW_SIZE = process.env.WINDOW_SIZE || 0;
const buffer = new Array();
let msgCount = 0;
if (USE_GCI === 'TRUE') {
app.use(gci);
}
app.get('/', function (req, res) {
let byteArray = new Array(MSG_SIZE);
let i = 0;
for (i; i < MSG_SIZE; i++) {
byteArray[i] = i;
}
if (WINDOW_SIZE > 0) {
buffer[msgCount++ % WINDOW_SIZE] = byteArray;
}
res.status(200).send();
});
app.listen(PORT, function () {
console.log('App listening on port ' + PORT + '!');
});