-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
34 lines (26 loc) · 1 KB
/
index.js
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
const express = require('express');
const socketIo = require('socket.io');
const SerialPort = require('serialport');
const { loggerStdoutNl } = require(`${__dirname}/src/utilities`);
const socketHandler = require(`${__dirname}/src/socketHandler`);
const spHandler = require(`${__dirname}/src/spHandler`);
const { inspect } = require('util');
const app = express();
app.use(express.static('gui'));
app.use(express.static('bobble'));
app.get('/', function (req, res) {
res.sendFile(`${__dirname}/gui/index.html`);
});
app.get('/bobble', function (req, res) {
res.sendFile(`${__dirname}/bobble/index.html`);
});
const server = app.listen(3000, () => {
loggerStdoutNl(server.address());
});
const io = socketIo(server);
const socH = socketHandler(io);
const bla = spHandler(socH);
process.on('unhandledRejection', (reason, p) => {
// application specific logging, throwing an error, or other logic here
process.stderr.write(`Unhandled Rejection at: Promise ${inspect(p)}\nreason: ${inspect(reason)}`)
})