You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I am trying to use the node-postgres template and I am not familiar with AsyncLocalStorage api from nodejs. How should I use const db = database() in my app? I se two approches:
Call the database context everywhere I want to use it?
Call the database context at the start of a loader and pass it down to functions that need access to the database?
What is the recommended approach? Is it bad to call DatabaseContext.getStore() to many times?
And one follow-up question:
I see in the epic-stack from Kent C. Dodds they don't use a DatabaseContext. The epic-stack uses https://github.com/epicweb-dev/remember library to not initilize the db every request. What is the difference between the two approches?
The text was updated successfully, but these errors were encountered:
Hi! I am trying to use the node-postgres template and I am not familiar with AsyncLocalStorage api from nodejs. How should I use
const db = database()
in my app? I se two approches:What is the recommended approach? Is it bad to call
DatabaseContext.getStore()
to many times?And one follow-up question:
I see in the epic-stack from Kent C. Dodds they don't use a DatabaseContext. The epic-stack uses https://github.com/epicweb-dev/remember library to not initilize the db every request. What is the difference between the two approches?
The text was updated successfully, but these errors were encountered: