Skip to content

Commit

Permalink
Tuning session stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
nicjohnson committed Mar 1, 2014
1 parent e48626b commit dbeb28c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
7 changes: 5 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ app.use(express.compress()); // Added manually for gzip compression
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(express.cookieParser('KvotheTheBloodless')); // Set the salt
app.use(express.cookieParser()); // Set the salt
app.use(express.session({
store: new RedisStore(process.env.REDISTOGO_URL)
store: new RedisStore(process.env.REDISTOGO_URL),
secret: 'KvotheTheBloodless',
key: 'sid',
cookie: { maxAge: 14* 24 * 60 * 60 * 1000 } // 2-week session
}));
app.use(experiment.check);
app.use(app.router);
Expand Down
2 changes: 0 additions & 2 deletions lib/experiment.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Look for experiment param
*/

// var _ = require('underscore');

exports.check = function (req, res, next) {
res.locals = {
exp: function (toCheck) {
Expand Down
2 changes: 1 addition & 1 deletion routes/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
*/

exports.list = function(req, res){
res.send("respond with a resource");
res.render('user');
};
14 changes: 14 additions & 0 deletions views/user.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>User</title>
<link rel='stylesheet' href='/stylesheets/style.css' />
</head>
<body>
<% if(exp('new')) { %>
<h1>New User</h1>
<% } else { %>
<h1>Old User</h1>
<% } %>
</body>
</html>

0 comments on commit dbeb28c

Please sign in to comment.