Nice example, thank you! Can you connect to DB only once and not in each api endpoint? What is the correct pattern and good place to do the initial DB connection when server is running?
Hello, check this out nextjs.org/docs/app/api-reference/next-config-js/serverComponentsExternalPackages server components using Mongoose is an experimental feature in Next 13. Next doesn’t have config for Mongoose by default
Hello. This is great. Thank you so much! I have one question though. I keep having this error where my application will connect to the db on one day but refuse completely to connect ton my db on another day and it is sending a timeout error. What could be the problem and how can I solve this issue