Prisma - Connect with different username on each request

Viewed 218

To achieve multitenancy in my NodeJS application, I'm looking for a way that on each user's request, I can connect it to the appropriate tenant, based on the arguments in the request headers.

For example, if header contains x-tenant: myTenant1 the database that should get established should contain the appropriate username and password while establishing a db connection.

In simple words, Can we establish database connection on each request (with different arguments) using Prisma?

0 Answers
Related