A friend just asked me a question: Can I make a React app and connect to Mongodb without setting up an Express server? I couldn't answer the question, I'm used to using the frontend-backend-database flow but I can't think of a reason why it's not possible to skip the backend part. I'm not sure if I can install mongoose and interact with the database directly from React, but it seems reasonable to me, especially for simple apps that just fetch and insert some info from and into a database. I think it might not be a great practice because it requires extra computational work on the browser, is that right? Sorry if the question is silly, I'm new to the web dev world.
Can I make a React app and connect to Mongodb without setting up an Express server?
You probably can, but you shouldn't (unless it is only you who is ever going to use this app). If the database is exposed directly to the frontend, anybody can see and change anything, including wiping the DB.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With