DEV Community

Discussion on: Getting Started with Sequelize and Postgres

Collapse
 
rnagarajan96 profile image
Nagarajan R

Awesome tutorial for beginners who they are just like me. Here I am new to nodeJs so i came up with idea's with some doubts (may be old but i found as a beginner i got nothing from stackoverflow). Here i am working based on Multi-Tenant Architecture. so every client organisations need to have their own Databases. so, in my case i am need to work with " 'n' no of databases ". from this tutorial i found the database connection is established during the app initialisation.so, to solve my case i need to establish the database connection dynamically based on the user request to their individual DB and need to perform CRUD operations ( Note : concurrent operations need to perform on their own db without disturb others ). so, i created another db and tried to perform dynamic connection based on user request but nothing helped me so, it's remained unsolved. i heard something about connection pool concept in sequelize that's may be related to my case. so, here i am posting this to expect answers and some suggestions from your side as theoretical and sample code. May be a new tutorial post that will help all people who fell in the same category. i found more peoples tried this but nothing is solid evidence.

Problem: Dynamic DB connection based on the user request not during app initialisation

Please correct me if my understanding is wrong, looking forward for your answer.

Regards,
Nagarajan R