> On 8 Jun 2015, at 23:38, Steve P <
stevea...@gmail.com> wrote:
>
> I'm working on a multi-tenant app in which each client will have their own database, each having the identical schemas and I need to be able to swap out the database I'm connecting to on a per request basis. I've been able to find nothing regarding this ability as near as I can tell the db connection is set at boot time.
>
> This is surely possible with Node, right?
Yes!
You're probably overthinking it: the simplest increment from 'connect at boot time to one database' is 'connect at boot time to all the databases, and pick the right connection at request time'.
From there it's a small step to make that lazily connect -- if there's a connection, use it. If not, create it and use it.
You may want to look at connection pooling libraries in the registry. They may help this.
Aria