I’m using express.session and connect-mongo be my DataStore.
What I’m facing is… in my server, I have 20 different app.get() calls. but not all of them require to check the session.
however, if i do this in the beginning of my server:
express.createServer( express.session({ ... }));
Then every single call will trigger the express.session and thus, set a session to mongoDB.
How to I limit to only the ones I want to trigger express.session?
e.g. app.get('/getASession') will get a session
app.get('/donotGetSession') will not even trigger express.session
I find out the solution. express.session return as a function. so I can do this:
so, if I don’t want soemthing use session, then i don’t put mySession there. 🙂 simple. i love node. 😀