Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep user logged when restarting a sails.js application

Tags:

sails.js

I'm working on a sails app still under development.

Each time I make a modification in a controller, I need to restart sails with a 'sails lift' command. Hopefully, it can be eased by using 'forever' tool which detect modifications and restart automatically.

But I need to re-log into my application (because the session is lost when restarting ?) which is really not convenient.

Is there any way to keep the user logged when restarting ?

like image 490
arnaud del. Avatar asked Mar 15 '23 14:03

arnaud del.


1 Answers

You can install redis locally and use it as a session store for development by installing connect-redis and adding the following lines to config/env/development.js

module.exports = {
  session : {
    adapter: 'redis'
  }
}

This way session data is not stored in memory and are not affected from sails restarts

like image 71
Ofer Herman Avatar answered Mar 18 '23 02:03

Ofer Herman