forked from probits-as/MeetEasier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
30 lines (22 loc) · 1.04 KB
/
server.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
// server.js
// set up ======================================================================
const express = require('express');
const app = express();
// configuration ===============================================================
// use public folder for js, css, imgs, etc
app.use(express.static("static"));
app.use(express.static(`${__dirname}/ui-react/build`));
// Read the .env-file
require('dotenv').config();
// routes ======================================================================
require("./app/routes.js")(app);
// launch ======================================================================
const port = process.env.PORT || 8080;
const theserver = app.listen(port, function() {
// call controller functions -------------------------------------------------
const io = require('socket.io')(theserver, { allowEIO3: true });
// controller if using room lists
const controller = require('./app/socket-controller.js')(io);
// log something so we know the server is working correctly
console.log(`Started on port: ${port}`);
});