Skip to content

Commit

Permalink
More tweaking
Browse files Browse the repository at this point in the history
  • Loading branch information
terakilobyte committed Jun 16, 2015
1 parent a662187 commit 9e8796a
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var https = require('https'),
flash = require('express-flash'),
path = require('path'),
expressValidator = require('express-validator'),
forceDomain = require('forcedomain'),
lessMiddleware = require('less-middleware'),
pmx = require('pmx'),

Expand Down Expand Up @@ -303,18 +302,16 @@ var options = {
};

if (process.env.NODE_ENV === 'production') {
app.start = function() {
var server = https.createServer(options, app);
console.log('https://' + process.env.HOST + ':' + process.env.PORT);
server.listen('https://' + process.env.HOST + ':' + app.get('port'), function () {
console.log(
'FreeCodeCamp server listening on port %d in %s mode',
app.get('port'),
app.get('env')
);
app.emit('started', 'https://' + process.env.HOST + ':' + app.get('port'));
});
};
var server = https.createServer(options, app);
console.log('https://' + process.env.HOST + ':' + process.env.PORT);
server.listen('https://' + process.env.HOST + ':' + app.get('port'), function () {
console.log(
'FreeCodeCamp server listening on port %d in %s mode',
app.get('port'),
app.get('env')
);
app.emit('started', 'https://' + process.env.HOST + ':' + app.get('port'));
});
} else {
app.start = function () {
app.listen(app.get('port'), function () {
Expand All @@ -325,11 +322,12 @@ if (process.env.NODE_ENV === 'production') {
);
});
};
if (require.main === module) {
app.start();
}
}

// start the server if `$ node server.js`
if (require.main === module) {
app.start();
}


module.exports = app;

0 comments on commit 9e8796a

Please sign in to comment.