Should I use Instrumentation to make a connection to the database? #71523
Unanswered
Tik1993
asked this question in
App Router
Replies: 1 comment
-
|
Im running drizzle migrations in instrumentation without any problem |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to connect to MongoDB using Mongoose in Next.js, but I’m thinking about where I should place my connectDB function to handle the database connection. I find that Instrumentation is a good feature since the register function is called once when a new Next.js server instance is initiated.
If not, should I place the connectDB function in the root layout file, or inside every function that needs to connect to the database?
Beta Was this translation helpful? Give feedback.
All reactions