MERN is an acronym that stands for MongoDB, Express, React, and Node, the four key technologies that comprise the stack.
What is the MERN Stack?
MongoDB is a document storage system.
Express(.js) is a web framework written in Node.js.
How does the MERN stack work?
React.js Front End
React’s strong suit is handling stateful, data-driven interfaces with minimal code and pain, and it has all the bells and whistles you’d expect from a modern web framework: great form support, error handling, events, lists, and more.
Express.js and Node.js Server Tier
The Express.js server-side framework, which runs inside a Node.js server, is the next level down. Express.js bills itself as a “fast, unopinionated, minimalist web framework for Node.js,” and it is. Express.js includes robust models for URL routing (which matches an incoming URL with a server function) and handling HTTP requests and responses.
You can connect to Express.js functions that power your application by sending XML HTTP Requests (XHRs), GETs, or POSTs from your React.js front-end. These functions, in turn, use MongoDB’s Node.js drivers to access and update data in your MongoDB database, either via callbacks or Promises.
MongoDB Database Tier
What is mern stack development If your application stores data (user profiles, content, comments, uploads, events, and so on), you’ll need a database that’s as simple to use as React, Express, and Node.
That’s where MongoDB comes in: JSON documents generated by your React.js front end can be sent to the Express.js server, where they can be processed and (if valid) stored directly in MongoDB for later retrieval. Again, if you’re building in the cloud, Atlas is a good place to start. Continue reading if you want to set up your own MERN stack!