Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Squashed merge of Nodester deployment branch.

  • Loading branch information...
commit 15e50b59b07a326f744d9993c755e00a7ad52f84 1 parent 3c06533
@akavlie akavlie authored
Showing with 19 additions and 6 deletions.
  1. +4 −2 assets/js/client.js
  2. +11 −4 lib/webserver.js
  3. +4 −0 views/layout.jade
View
6 assets/js/client.js
@@ -11,9 +11,10 @@
//= require_tree 'views'
-// Global object
+// Websockets talk on port 80 on Nodester, regardless of listen port
+if (ENV === 'production') PORT = 80;
window.irc = {
- socket: io.connect(),
+ socket: io.connect(null, {port: PORT}),
chatWindows: new WindowList,
connected: false
};
@@ -189,6 +190,7 @@ $(function() {
});
irc.socket.on('netError', function(data) {
+ console.log(data);
irc.appView.showError('Invalid server');
});
View
15 lib/webserver.js
@@ -2,24 +2,31 @@ var express = require('express'),
path = require('path');
var app = exports.app = express.createServer();
+var port;
+
+// process.on('uncaughtException', function(err) {
+// console.log(err.stack);
+// });
app.configure(function() {
var basePath = path.join(__dirname, '..');
- app.use(require('connect-assets')({src: basePath + '/assets'}));
+ app.use(require('connect-assets')({build: false, src: basePath + '/assets'}));
app.use('/assets', express.static(basePath + '/assets'));
app.use('/img', express.static(basePath + '/assets/images'));
app.set('views', basePath + '/views');
});
app.configure('development', function() {
- app.listen(3000);
+ port = 3000;
});
app.configure('production', function() {
// Nodester port
- app.listen(14400);
+ port = 14858;
});
+app.listen(port);
+
app.get('/', function(req, res) {
- res.render('index.jade', { layout: true });
+ res.render('index.jade', {port: port, env: process.env.NODE_ENV || null});
});
View
4 views/layout.jade
@@ -5,6 +5,10 @@ html
link(href='/assets/images/favicon.ico', rel='icon', type='image/x-icon')
!= css('bootstrap.min')
!= css('subway')
+
+ script
+ var ENV = '#{env}',
+ PORT = #{port};
!= js('client')
include templates
body
Please sign in to comment.
Something went wrong with that request. Please try again.