Skip to content

Commit 8675a00

Browse files
committed
fix(twitter): revert mongoose connection change
reverting attempt to fix error setting ttl connection which was causing other errors
1 parent c27cefe commit 8675a00

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

Diff for: app/templates/server/app.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,11 @@ var socketio = require('socket.io').listen(server);
2424
require('./config/socketio')(socketio);<% } %>
2525
require('./config/express')(app);
2626
require('./routes')(app);
27-
<% if (filters.twitterAuth) { %>
28-
mongoose.connection.on('connected', function () {
29-
// Start server
30-
server.listen(config.port, config.ip, function() {
31-
console.log('Express server listening on %d, in %s mode', config.port, app.get('env'));
32-
});
33-
});<% } else { %>
27+
3428
// Start server
3529
server.listen(config.port, config.ip, function () {
3630
console.log('Express server listening on %d, in %s mode', config.port, app.get('env'));
37-
});<% } %>
31+
});
3832

3933
// Expose app
4034
exports = module.exports = app;

Diff for: app/templates/server/config/express.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,15 @@ module.exports = function(app) {
3333
app.use(cookieParser());
3434
<% if (filters.auth) { %>app.use(passport.initialize());<% } %><% if (filters.twitterAuth) { %>
3535

36-
mongoose.connection.on('connected', function () {
37-
// Persist sessions with mongoStore
38-
// We need to enable sessions for passport twitter because its an oauth 1.0 strategy
39-
app.use(session({
40-
secret: config.secrets.session,
41-
resave: true,
42-
saveUninitialized: true,
43-
store: new mongoStore({ mongoose_connection: mongoose.connection })
44-
}));
45-
});<% } %>
46-
36+
// Persist sessions with mongoStore
37+
// We need to enable sessions for passport twitter because its an oauth 1.0 strategy
38+
app.use(session({
39+
secret: config.secrets.session,
40+
resave: true,
41+
saveUninitialized: true,
42+
store: new mongoStore({ mongoose_connection: mongoose.connection })
43+
}));
44+
<% } %>
4745
if ('production' === env) {
4846
app.use(favicon(path.join(config.root, 'public', 'favicon.ico')));
4947
app.use(express.static(path.join(config.root, 'public')));

0 commit comments

Comments
 (0)