Question regarding fetching data from api or use driver? #722
-
I was wondering whether we should fetch the data from the API endpoint or use the Mongoose driver to retrieve the data in the loader function for Remix?
I have a database in MongoDB Atlas, and I can either use their data API endpoints or drivers to retrieve the data. My question for Remix is, what is the correct approach to do it? If we decide to use the Mongoose driver, where should we place the mongoose.connect function? Should we place it in the server.tsx file or somewhere else? Any help would be appreciated. Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hello @jamalsoueidan . This sounds like a Remix question, so you may have more success looking at their docs and asking their community in Discord. Additionally you may find Mongo documentation for Remix, like this article on their website that talks about how to integrate MongoDB Atlas with Remix. Hopefully these resources help you find an answer. Thanks! |
Beta Was this translation helpful? Give feedback.
In Hydrogen, we use minioxygen, which emulates our Oxygen deployment platform. It is different in some ways to a normal Node environment, so no, they're not 100% compatible. It's much more comparable to Cloudflare Workers, so you may have better luck looking how to use Mongoose with that? For example, maybe this article? I could be wrong on that, though.