Skip to content Skip to sidebar Skip to footer

How To Store Session Values With Node.js And Mongodb?

How do I get sessions working with Node.js, express@2.0.0 and mongodb? I'm now trying to use connect-mongo like this: var config = require('../config'), express = require('expr

Solution 1:

Take a look at this series from DailyJS. It uses MongoDB and session management

http://dailyjs.com/tags.html#lmawa


Solution 2:

I am not experienced with Node.js or Express, so I cannot immediately see what's wrong with your approach. However, I have made Express use MongoDB to store sessions for flash messages and other session stuff.

You can see my source code for a simple URL shortener here (that actually makes the URLs pretty long at the moment - it was just an exercise ;)). I use the session to store a list of URLs that the current user has shortened.

It is not pretty, but I know it works.


Post a Comment for "How To Store Session Values With Node.js And Mongodb?"