Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequelize support #69

Closed
IonicaBizau opened this issue Aug 25, 2017 · 3 comments
Closed

Sequelize support #69

IonicaBizau opened this issue Aug 25, 2017 · 3 comments

Comments

@IonicaBizau
Copy link

This module works great! I'm very thankful for your amazing work! ✨

Is there any chance to add a feature to accept a Sequelize instance along with the current options? It would simplify the logic in many cases (for me and eventually for others).

Currently, I have an instance of Sequelize, but also have to parse the MySQL URI to get the credentials and pass them to this module.

@chill117
Copy link
Owner

chill117 commented Aug 25, 2017

I think that's outside the scope of this project. You can already pass an existing MySQL connection to the constructor like this:

var mysql = require('mysql');
var session = require('express-session');
var MySQLStore = require('express-mysql-session')(session);

var options = {
    host: 'localhost',
    port: 3306,
    user: 'db_user',
    password: 'password',
    database: 'db_name'
};

var connection = mysql.createConnection(options); // or mysql.createPool(options);
var sessionStore = new MySQLStore({}/* session store options */, connection);

It might be possible to do something similar with Sequelize.

@rahul26goyal
Copy link

the problem is when i m using sequelize for connecting to db and now i have to use MySQL as well for the session. This increases my connection pool size. Now I need to allocate 2 different pool.

@chill117
Copy link
Owner

I think it's possible to pass an existing MySQL connection pool object to Sequelize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants