-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
32 lines (25 loc) · 898 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
28
29
30
31
32
// express, package used for the creation of the server
const express = require('express');
// socket.io, package used for real time web application
const socket = require('socket.io');
const app = express();
const bodyParser = require('body-parser');
const fs = require('fs');
const util = require('util');
const log_file = fs.createWriteStream(__dirname + '/debug.log', { flags: 'w' });
const log_stdout = process.stdout;
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(bodyParser.json());
// creation of the server, server is running on port 8080
const server = app.listen(8000, function () {
console.log('server is running on port 8000')
});
// creation of the constant that will be used for the socket
const io = socket(server);
require('./backend/socket/handler/handler.js')(io);
module.exports = {
io: io,
server: server
};