What is Mean Stack - Mean Stack Tutorial
What is Mean Stack
- M - MongoDB
- E - ExpressJS
- A - AngularJS
- N - NodeJS
- Is a schema-less NoSQL database system.
- MongoDB saves data in binary JSON format, which makes it easier to pass data between client and server.
- Is a web application framework for Node.js.
- It enables you to build server applications in Node.js and is a backend application that connects the front-end and databases.
- Is the frontend technology in the stack.
- The user interacts with the AngularJS UI components at the application front-end that resides in the browser. An ExpressJS server, written in NodeJS, serves the front-end.
- Any interaction that causes a data change request is sent to the NodeJS-based Express server.
- The server grabs data from the MongoDB database (if required) and returns it to the frontend of the application, which then presents it to the user.
MEAN Stack Components
Angular.js Front End
Express.js and Node.js Server Tier
- The next level down is Express.js, running on a Node.js server. Express.js calls itself a “fast, unopinionated, minimalist web framework for Node.js,” and that is indeed exactly what it is.
- Express.js has powerful models for URL routing (matching an incoming URL with a server function), and handling HTTP requests and responses.
- By making XML HTTP requests (XHRs),r GETs, or POSTs from your Angular.js front end, you can connect to Express.js functions that power your application.
- Those functions in turn use MongoDB’s Node.js drivers, either via callbacks or using Promises, to access and update data in your MongoDB database.
MongoDB Database Tier
- If your application stores any data (user profiles, content, comments, uploads, events, etc.), then you’re going to want a database that’s just as easy to work with as Angular, Express, and Node.
- That’s where MongoDB comes in: JSON documents created in your Angular.js front end can be sent to the Express.js server, where they can be processed and (assuming they’re valid) stored directly in MongoDB for later retrieval.
Advantages of MEAN Stack
- MEAN applications can be used in many ways with a cross platform write once approach. While MEAN is particularly suited to real-time applications, particularly those running natively in the cloud and single-page (dynamic) web applications built in Angular.js, it can be used for other use cases such as:
- Workflow management tools.
- News aggregation sites.
- Todo and calendar applications.
- Interactive forums.
- Express makes routing and managing HTTP requests and responses super easy, and includes great support for middleware to handle JSON endpoints and form posts. Angular is a powerful tool for building dynamic HTML pages that communicate with a back-end server.
- Whether you’re building a high-throughput API, a simple web application, or a microservice, MEAN is the ideal stack for building Node.js applications.
- All of the MEAN stack components are open source in nature and therefore allow a generous, free-of-charge opportunity for developers.