Divide the database connection pool between sequelize and pg

I have a server that I wrote using Express and node-postgres (pg). He creates his own database pool:

const dbPool = new pg.Pool(dbConfig);

and runs SQL queries directly using this connection.

Now I am adding a new table and the corresponding REST API. I would like to use sequelize and epilogue to reduce the pattern. Unfortunately, sequelize wants to create its own database connection pool:

const sequelize = new Sequelize(database, user, password, config);

Can I reuse an existing connection pool or otherwise share it between my existing code pgand my new code sequelize?

+4
source share

Source: https://habr.com/ru/post/1654385/


All Articles