Kopie van https://gitlab.com/studieverenigingvia/ict/centurion met een paar aanpassingen
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
618 B
22 lines
618 B
const express = require("express");
|
|
const socketIO = require("socket.io");
|
|
const state = require("./State.js");
|
|
const path = require("path");
|
|
|
|
const HOST = '0.0.0.0';
|
|
const PORT = 3001;
|
|
|
|
const app = express();
|
|
const server = app.listen(PORT, HOST,() => console.log(`Centurion listening on port ${PORT}!`));
|
|
app.use(express.static(path.join(__dirname, '../public')));
|
|
|
|
const io = socketIO(server);
|
|
|
|
app.get('/state', (req, res) => res.send('<pre>' + JSON.stringify(state) + '</pre>'));
|
|
|
|
process.on('SIGINT', () => process.exit());
|
|
process.on('SIGTERM', () => process.exit());
|
|
|
|
module.exports = {
|
|
app, server, io
|
|
};
|
|
|