Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #187 from Fauntleroy/update-express

update express to 3.0.x
  • Loading branch information...
commit ad6f4a685e649e124f123a8cee97cf42179ae0ee 2 parents 2a7ebce + 3ee84b8
@thedjpetersen authored
View
17 lib/subway.js
@@ -1,10 +1,12 @@
// register mongodb models
require('./models.js')()
-var app = require('./webserver').app,
- sockethandler = require('./socket'),
- io = require('socket.io'),
- mongoose = require('mongoose');
+var http = require('http'),
+ app = require('./webserver').app,
+ server = require('./webserver').server,
+ sockethandler = require('./socket'),
+ io = require('socket.io'),
+ mongoose = require('mongoose');
process.on('uncaughtException', function(err) {
console.log('Caught exception: ' + err);
@@ -12,6 +14,7 @@ process.on('uncaughtException', function(err) {
var Subway = function() {
this.app = app;
+ this.server = server;
}
Subway.prototype.start = function () {
@@ -20,7 +23,7 @@ Subway.prototype.start = function () {
mongoose.connect(this.app.set('mongoose_auth'));
// link up socket.io with our express app
- this.io = io.listen(this.app);
+ this.io = io.listen(server);
this.io.sockets.on('connection', function(socket) {
sockethandler(socket, connections);
@@ -29,7 +32,7 @@ Subway.prototype.start = function () {
// restore sessions
require('./restore')(connections);
- if (this.app.address()) console.log('Subway started on port %s', this.app.address().port);
+ if (this.server.address()) console.log('Subway started on port %s', this.server.address().port);
}
-module.exports = Subway;
+module.exports = Subway;
View
10 lib/webserver.js
@@ -1,8 +1,10 @@
-var express = require('express'),
+var http = require('http'),
+ express = require('express'),
path = require('path'),
config = require('../config');
-var app = exports.app = express.createServer();
+var app = exports.app = express();
+var server = exports.server = http.createServer( app );
app.configure(function() {
var basePath = path.join(__dirname, '..');
@@ -30,8 +32,8 @@ app.configure('production', function() {
});
var port = app.set('port'); // Get port for current environment
-app.listen(port);
+server.listen(port);
app.get('/', function(req, res) {
res.render('index.jade', {port: app.set('client_port'), env: process.env.NODE_ENV || null});
-});
+});
View
2  package.json
@@ -17,7 +17,7 @@
"PYTHON": "/opt/local/bin/python2.7"
},
"dependencies": {
- "express": "2.5.x",
+ "express": "3.0.x",
"jade": "0.26.x",
"connect-assets": "2.2.x",
"irc": "git://github.com/noraesae/node-irc.git",
View
2  views/index.jade
@@ -1,2 +1,4 @@
+extends layout
+
block content
p Test
Please sign in to comment.
Something went wrong with that request. Please try again.