Reputation: 2002
I am currently developing a node.js webapp, which can access a subversion server with a nice web UI.
To access the server I need authentication data. My first attempt was to store them with app.set('username', 'theo')
and app.set('password', 'start')
. Later I saw, that this is a very bad idea, because then, the authdata are going to be in the app settings until it restarts.
My question is now, how can I store data during a session over multiple requests using nodejs and express?
PS: A database is sadly no option...
Upvotes: 0
Views: 220
Reputation: 730
You can also use redis for nodejs and predis package for php redis. It is very easy for you.
All the best..!!!
Upvotes: 1
Reputation: 21
You can also use REDIS to store the sessions, even if the express falls you will still have the sessions on REDIS and the users won't have to authenticate again.
Upvotes: 1
Reputation: 730
You may use "mamcached" for store your session information using nodejs. Thorough this you may help in integration with any web server session also.
Upvotes: 2
Reputation: 2002
Ok, I just oversaw it. The express module express-session
was what I needed :)
This is my code now:
var session = require('express-session')
app.use(session({ secret: 'supersecret' }))
And when I need the session I jsut go with
req.session.username = 'theo'
Just if anybody has the same trouble like me :)
Upvotes: 2