-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.js
More file actions
35 lines (30 loc) · 1.08 KB
/
server.js
File metadata and controls
35 lines (30 loc) · 1.08 KB
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
31
32
33
34
35
// Server requires
let express = require('express');
let app = express();
let http = require('http').Server(app);
app.use(express.static('public'));
let io = require('socket.io')(http);
const logs = require('./logger');
logs.init();
const logger = logs.logger();
// Bot requires
let launcher = require('./main');
// Graphs requires
let graph = require('./web/graphsData');
// Server init
http.listen(3000, function() {
logger.info('Listening on *:3000');
});
// IO
io.on('connection', function(socket){
socket.on('disconnect', function() {});
socket.emit("chartData", graph.getHistoricGraph("balance"));
socket.emit("chartData", graph.getHistoricGraph("balance", null, null, "logarithmic"));
/*socket.emit("chartData", graph.getHistoricGraph("balanceCrypto"));
socket.emit("chartData", graph.getHistoricGraph("balanceCrypto", null, null, "logarithmic"));
socket.emit("chartData", graph.getHistoricGraph("buyPrice"));
socket.emit("chartData", graph.getHistoricGraph("netPercentage"));*/
socket.emit("stateData", launcher.state());
});
// Bot launch
launcher.main();