DEV Community


Discussion on: can I just use React + ExpressJS? Or React + MongoDB?

miicha profile image
Miikka Saxlund • Edited

You should never make database queries directly from the front end, as this exposes your database to malicious activities. It means that you will need some kind of a back end service handling queries to the database. This is what Express and Mongoose is great for. Express handles all the end points for HTTP-requests made from the React site, while Mongoose handles the queries to the MongoDB without exposing the database. In other words, Express application acts as a m̶i̶d̶d̶l̶e̶w̶a̶r̶e̶ middle tier between the website and the database.

priyadarshikunal profile image
Priyadarshi Kunal

Middle tier rather than middleware.