-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
38 lines (32 loc) · 802 Bytes
/
app.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
33
34
35
36
37
38
'use strict';
/**
*
* Main application
*/
var express = require("express"),
morgan = require("morgan"),
errorHandler = require('errorhandler'),
bodyParser = require('body-parser'),
http = require('http'),
app = express();
// Some middleware
app.use(morgan('dev'));
app.use(bodyParser.urlencoded({
extended: true
}));
// Require the master (cluster) app
require('./lib/master')(app);
// Development only
if (app.get('env') == 'development') {
app.use(errorHandler());
}
else {
app.use(function(err, req, res, next) {
console.error(err.stack);
res.send(500, 'Something broke!');
});
}
var port = Number(process.env.PORT || 5000);
http.createServer(app).listen(port, function(){
console.log('Express server listening on port ' + port);
});