Skip to content

Commit

Permalink
fix(twitter): revert mongoose connection change
Browse files Browse the repository at this point in the history
reverting attempt to fix error setting ttl connection which was causing other errors
  • Loading branch information
DaftMonk committed Jul 31, 2014
1 parent c27cefe commit 8675a00
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
10 changes: 2 additions & 8 deletions app/templates/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,11 @@ var socketio = require('socket.io').listen(server);
require('./config/socketio')(socketio);<% } %>
require('./config/express')(app);
require('./routes')(app);
<% if (filters.twitterAuth) { %>
mongoose.connection.on('connected', function () {
// Start server
server.listen(config.port, config.ip, function() {
console.log('Express server listening on %d, in %s mode', config.port, app.get('env'));
});
});<% } else { %>

// Start server
server.listen(config.port, config.ip, function () {
console.log('Express server listening on %d, in %s mode', config.port, app.get('env'));
});<% } %>
});

// Expose app
exports = module.exports = app;
20 changes: 9 additions & 11 deletions app/templates/server/config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,15 @@ module.exports = function(app) {
app.use(cookieParser());
<% if (filters.auth) { %>app.use(passport.initialize());<% } %><% if (filters.twitterAuth) { %>

mongoose.connection.on('connected', function () {
// Persist sessions with mongoStore
// We need to enable sessions for passport twitter because its an oauth 1.0 strategy
app.use(session({
secret: config.secrets.session,
resave: true,
saveUninitialized: true,
store: new mongoStore({ mongoose_connection: mongoose.connection })
}));
});<% } %>

// Persist sessions with mongoStore
// We need to enable sessions for passport twitter because its an oauth 1.0 strategy
app.use(session({
secret: config.secrets.session,
resave: true,
saveUninitialized: true,
store: new mongoStore({ mongoose_connection: mongoose.connection })
}));
<% } %>
if ('production' === env) {
app.use(favicon(path.join(config.root, 'public', 'favicon.ico')));
app.use(express.static(path.join(config.root, 'public')));
Expand Down

0 comments on commit 8675a00

Please sign in to comment.