-
Notifications
You must be signed in to change notification settings - Fork 75
/
server.js
27 lines (20 loc) · 978 Bytes
/
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
// server.js
// set up ======================================================================
var express = require('express');
var app = express();
// configuration ===============================================================
// use public folder for js, css, imgs, etc
app.use(express.static('static'));
app.use(express.static(`${__dirname}/ui-react/build`));
// routes ======================================================================
require('./app/routes.js')(app);
// launch ======================================================================
const port = process.env.PORT || 8080;
var theserver = app.listen(port, function(){
// call controller functions -------------------------------------------------
var io = require('socket.io').listen(theserver);
// controller if using room lists
var controller = require('./app/socket-controller.js')(io);
// log something so we know the server is working correctly
console.log(`now we're cooking.`);
});