-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
34 lines (27 loc) · 747 Bytes
/
server.js
File metadata and controls
34 lines (27 loc) · 747 Bytes
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
33
34
/**
* server.js
*
*/
var express = require('express'),
path = require('path'),
bodyParser = require('body-parser'),
errors = require('common-errors'),
morgan = require('morgan'),
services = require('./services'),
logger = services.logger,
PORT_NUM = process.env.PORT || '8080',
app = express();
module.exports = app;
// Middleware
app.use(morgan('dev'));
app.use(bodyParser.json());
// Routes
app.use(express.static(path.join(__dirname, 'public')));
app.use('/spectate', require('./routes/spectate'));
// Error Handler
app.use(errors.middleware.errorHandler);
// Since its included in the gulp file
if (!module.parent) {
app.listen(PORT_NUM);
logger.info('Server listening on port: %s', PORT_NUM );
}