That’s one MEAN stack

On Thursday (6/26/2014), we had a nice meet up for the Southwest Florida [.net] Developers Groupwhere I was happy to see some old friends and get the opportunity to present on the MEAN stack. This is a little out of my comfort zone since I am just learning this stack and am by no means an expert on it, but it was fun nonetheless.

This blog post is a bit of a recap on what we covered with some follow up links for more information.

What is the MEAN stack?

The MEAN stack is Mongo as the database, Express as a web server framework, Node as the underlying server, and Angular as the client-side framework. Let’s take a minute and briefly discuss each of these technologies.

Mongo

Mongo DB is a NoSQL document database that uses Javascript syntax and stores data as BSON (binary json). It’s not a Mickey Mouse database; it’s actually quite powerful, and it’s free.

Some of the highlights of Mongo are:

  • Document database (NoSQL)
  • Javascript syntax
  • Stored as BSON (binary JSON)
  • Collections instead of tables
  • Single instance or sharded cluster
  • Replicated servers with automatic master failover

You can learn more about Mongo through 10gen’s introduction.

Also, take a look at comparing SQL to Mongowhich is a great article if you’re already experienced in relational databases.

Express

Express is a web-server framework that sits on top of node. It’s very lightweight and just makes node a little easier to use for web-based activities.

It’s not the only web framework for node, but it certainly is the most popular. Learn more about express.

Node

Node is server-side Javascript which focuses on non-blocking IO and is uses an event driven model. At first, the notion of writing Javascript to run the server-side code seemed a bit odd to me, but once I got over my old preconceptions of the limitations, I really embraced it.

The “hello world” of node looks a bit like this:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

You can learn more about node by visiting the official website.

Angular

Angular is a front-end framework for Javascript web applications which is supported by Google. Angular has the following benefits (among others):

  • Creation of new directives which allow you to augment HTML controls.
  • Clean separation of view, controllers, and services.
  • A simple to use binding mechanism for updating the view based on changes in the controller.
  • Testable using the IoC pattern.

More information can be found on the official website.

Try it out

You can try out the MEAN stack in several ways. First, as we did during the meeting, install each component manually by first installing node, and then using npm and bower to install the other packages. You can follow the public Trello boardfor simple steps that we followed during the presentation.

Two additional ways, which are quite a bit quicker and include additional libraries not covered during the presentation, are to use mean.ioand yeoman.io. Both of these are scaffolding tools to get you up quickly and provide a solid foundation to work from.

This blog post is a bit of a recap on what we covered with some follow up links for more information.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s