Whenever I make changes to my app, nodemon restarts the whole app, but every time this happens, my session gets destroyed. This is getting annoying since I have to sign in every time I make changes to my app. How do I avoid this from happening?
I'm using cookie based sessions since I only store the userid. My setup looks like this (in coffeescript):
app.use express.cookieParser()
app.use express.session
secret: 'mysecretkey'
app.use express.csrf()
And I save my session by doing this:
req.session.userid = user._id.toHexString() # it's a mongoDB ObjectID
req.session.save()