Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor

  • Loading branch information...
commit 60ae33e6fde94fae2631b80afaf15da5bcac76a3 1 parent 65d9071
@pablomolnar authored
Showing with 20 additions and 4 deletions.
  1. +20 −4 app.js
View
24 app.js
@@ -1,11 +1,17 @@
-// Module dependencies.
-var express = require('./node_modules/express')
+var __dirname = "."
+var port = (process.env.VMC_APP_PORT || 3000);
+var host = (process.env.VCAP_APP_HOST || 'localhost');
+
+// Module dependencies.
+//require.paths.unshift('./node_modules');
+
+var express = require('express')
, routes = require('./routes')
, io = require('socket.io');
var app = module.exports = express.createServer()
, io = io.listen(app);
-
+
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
@@ -24,6 +30,16 @@ app.configure('production', function(){
app.use(express.errorHandler());
});
+if(process.env.VMC_APP_PORT) {
+ io.set('transports', [
+ //'websocket',
+ 'flashsocket',
+ 'htmlfile',
+ 'xhr-polling',
+ 'jsonp-polling'
+ ]);
+}
+
// Routes
app.get('/', routes.index);
@@ -46,5 +62,5 @@ io.sockets.on('connection', function (socket) {
});
});
-app.listen(process.env.VCAP_APP_PORT || 3000);
+app.listen(port);
console.log("Server listening on port %d in %s mode", app.address().port, app.settings.env);
Please sign in to comment.
Something went wrong with that request. Please try again.