Embed URL


SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

express 3.x cookie session middleware example

View app.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
var express = require('express')
, cookieSessions = require('./cookie-sessions');
var app = express();
app.use(express.cookieParser('manny is cool'));
app.get('/', function(req, res){
req.session.count = req.session.count || 0;
var n = req.session.count++;
res.send('viewed ' + n + ' times\n');

TypeError: Object # has no method 'signedCookie'
-- should change to res.cookie(name, req.session, {signed: true});


Do you know how can I store the session using MongoDb (I'm using mongoose).

EFF commented

@limoragni, you can use session-mongoose, works fine but as explained, not ready for production ...

res.signedCookie(name, req.session, { signed: true });

in both source code & official docs, there is NO res.signedCookie, but only res.cookie(name, req.session, {signed: true}); which works exactly as setting singed cookies!

Is it possible to use couchDB for session storage?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.