Skip to content

feat(express): add express-sequelize-session #1173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"bluebird": "^2.9.34",
"connect-mongo": "^0.8.1",<% } %><% if (filters.sequelize) { %>
"sequelize": "^3.5.1",
"sqlite3": "~3.0.2",<% } %><% if (filters.auth) { %>
"sqlite3": "~3.0.2",
"express-sequelize-session": "0.4.0",<% } %><% if (filters.auth) { %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really only need connect-mongo or express-sequelize-session when filters.twitterAuth. Would you mind adding the if (filters.twitterAuth) for those two deps?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I didn't bother, since they're required for the Lusca PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gotcha. Well then, we probably need this before #1166 passes tests.

"jsonwebtoken": "^5.0.0",
"express-jwt": "^3.0.0",
"passport": "~0.2.0",
Expand Down
7 changes: 5 additions & 2 deletions app/templates/server/config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ var config = require('./environment');<% if (filters.auth) { %>
var passport = require('passport');<% } %><% if (filters.twitterAuth) { %>
var session = require('express-session');<% if (filters.mongoose) { %>
var mongoStore = require('connect-mongo')(session);
var mongoose = require('mongoose');<% } %><% } %>
var mongoose = require('mongoose');<% } else if(filters.sequelize) { %>
var sqldb = require('../sqldb');
var Store = require('express-sequelize-session')(session.Store);<% } %><% } %>

module.exports = function(app) {
var env = app.get('env');
Expand All @@ -42,7 +44,8 @@ module.exports = function(app) {
store: new mongoStore({
mongooseConnection: mongoose.connection,
db: '<%= _.slugify(_.humanize(appname)) %>'
})<% } %>
})<% } else if(filters.sequelize) { %>,
store: new Store(sqldb.sequelize)<% } %>
}));
<% } %>
app.set('appPath', path.join(config.root, 'client'));
Expand Down