-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
32 lines (24 loc) · 862 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
const express = require('express');
const indexRoute = require('./app/routes/index');
const appRoute = require('./app/routes/app');
const path = require('path');
const socket = require('./app/models/socket-io/socket-io');
require('dotenv').config();
/* Defines the application */
let app = express();
/* Body Parser for JSON format variables
* Access the variable via the *.body field */
/* Set the URI here */
app.use(express.static(path.join(__dirname, '/app/views')));
app.use(appRoute);
/* Default routing. Keep at the end */
app.use(indexRoute);
/* Sets the server to port 3000.
* Opens port 3000 to listen for connections
* Otherwise use heroku provided port */
app.set('port', 3002);
let server = app.listen(app.get('port'), () => {
console.log('[Server] : open on port ' + app.get('port'));
});
socket.start(server);
module.exports = app;