Are you a veteran LAMP stack developer
looking to somehow evolve to your next generation platform?
If so, you're going to love our topic today.
Hello, my name is Jamil Spain, Developer Advocate with IBM Cloud,
and today my topic's going to be concerning the acronym MEAN.
But it's not going to be "mean" that perspective,
we're going to be very nice and code up some great things here.
So as usual, whenever we get started, I love to break down the acronyms
and then we'll hit the whiteboard and show you how all these components kind of fit together.
So let's break this acronym down.
We have the MEAN, the M, of course, which is going to stand for MongoDB.
Talking about the main data store, that's a component of that.
We have the E, which stands for "xpress".
Express.js, we all know, it's a web application framework built on top of JavaScript.
The A is for "Angular".
All right, SPA application development there.
And then as more of the platform, we're going to go with the N, which is Node.js.
And so if you recall from my previous video on the LAMP stack,
this is more centered around Linux, Apache, PHP does a lot of the work,
of course there's a data store option there, which is mySQL.
And now we're going to take this to the next step with the MEAN platform,
and we'll talk about a couple of variations that can occur as well.
So I'm going to get started by, as usual, drawing out things how they are.
And we're going to have a couple of layers here, but this is going to be quite common, that we're going to have.
So let's think of it like this.
Let's start with our foundation here.
And the first foundation is going to be Node.js.
All right.
Node.js has quickly grown over the decades to being quite an impressive language,
evolved into not only a front-end through JavaScript,
a front-side scripting language, to now even working on the server side.
And one of the most popular packages that most applications are developed in is,
let's see if I can squeeze that in, is the Express web application framework.
All right.
It's going to install as a part of the Node.js computing language.
It will bring up the ability to quickly let you scale up web applications built upon that.
Not only can you define your routes,
but also it will be that piece that kind of can make connections to the database.
All right, so we're going to deal with MongoDB here.
So the Express will have all the modules that are used to kind of function and run,
make connections to the database, expose other routes,
as well as connect to any other kind of languages that are there.
It is all part of the JavaScript model there.
If you're familiar with the NPM package manager, you can simply import packages,
make references to acquire them inside of Express routes or models there,
and then work with everything.
So on top of that, the last part we'll talk about is the A, which stands for Angular.
And this is going to fit in to be what we like to call our Single Page Applications (SPA).
Everyone's familiar with Angular, one of the popular frameworks for building SPA applications from Google.
And what this is going to do is really take control of the complete front end there.
SPA applications, as you know, in comparison to traditional page applications,
is really just going to have that main entry level loading, so maybe that first route,
and then it only declaratively refreshes pages of the page that you want to pretty much that you focus on.
So when I want to kind of describe it a little bit more.
Let's say our web page comes in and it's with a header and a menu and then content here.
So as I click links here, only this part will actually refresh as I click links.
All right.
Whereas in most traditional page applications,
the whole page would refresh and you have to constantly deal with loading times from that.
So what this does is pretty much allows you to build in these modern interfaces,
and most of the most modern applications are coming as SPA applications,
"Single Page Applications" there.
Express is the framework that serves that out.
When Angular needs to make connections to a database its pretty much going to talk to the express framework,
which will make the connection to Mongo, which will give the response back
and then serve it back to that session there as well.
And, of course, Angular is free to make any other Ajax calls as it needs.
Now you're probably thinking to yourself, "MEAN, OK, but what if I don't use Angular?"
What if I use another popular language, which is one that I use a lot, React?
And so, yes, you can substitute different parts here to do different things.
All right.
Often I've made my acronym, I guess that makes it "MERN", all right?
The Mongo, Express, React and Node.js., that's there,
so you can often switch out any component that you are looking to use that can really fit your scenario here.
So that's all for now.
This is the MEAN stack.
I encourage you to go check it out.
It was naturally my next evolution after I became an expert at building LAMP stacks
and then wanted to make my move into more fluid single page
using MongoDB, because everything's done as a document, JSON document,
everything's flexible, fluid, fast to develop,
and nothing beats the experience of a single page application.
So that's all for today.
Thank you for your time.
Happy coding!
If you have any questions, please drop us a line below,
and if you want to see more videos like this in the future, please like and subscribe.