Introduction - MEAN Machine - A beginner's practical guide to the JavaScript stack (2015)

MEAN Machine - A beginner's practical guide to the JavaScript stack (2015)

Introduction

Node is an exciting JavaScript language for web development that has been growing in popularity in recent years. It started out for small development projects and has since penetrated the enterprise and can be seen in large companies like Microsoft, eBay, LinkedIn, Yahoo, WalMart, Uber, Oracle, and several more.

Why MEAN?

The MEAN stack uses four pieces of software: MongoDB, ExpressJS, AngularJS, and NodeJS. Using these four tools together lets developers create efficient, well organized, and interactive applications quickly.

Since every component of the stack uses JavaScript, you can glide through your web development code seamlessly. Using all JavaScript lets us do some great things like:

· Use JavaScript on the server-side (Node and Express)

· Use JavaScript on the client-side (Angular)

· Store JSON objects in MongoDB

· Use JSON objects to transfer data easily from database to server to client

A single language across your entire stack increases productivity. Even client side developers that work in Angular can easily understand most of the code on the server side.

Starting with the database, we store information in a JSON like format. We can then write JSON queries on our Node server and send this directly to our front-end using Angular. This is especially useful when you have multiple developers working on a project together. Server-side code becomes more readable to front-end developers and vice versa. This makes everything a little more transparent and has been shown to greatly increase development time. The ease of development will become much more apparent once we start digging into examples and hopefully save you and your team some headaches in the future.

When To Use the MEAN Stack

The MEAN stack benefits greatly from the strengths of Node. Node let’s us build real-time open APIs that we can consume and use with our frontend Angular code. Transferring data for applications like chat systems, status updates, or almost any other scenario that requires quick display of real-time data.

· Chat client

· Real-time user updates (like Twitter feed)

· RSS feed

· Online shop

· Polling app

When NOT To Use the MEAN Stack

As with any language or set of languages, there are plenty of scenarios where MEAN wouldn’t be the best fit and it’s very important to recognize this before diving into coding. A lot of the benefits of the MEAN stack and reasons why you would use it are rooted in its use of Node. We see this same trend again with reasons you may not want to use it.

Node is generally not the best pick for CPU intensive tasks. There have been a few arguments for cases where Node actually did well in computationally heavy applications, but for the novice it’s best to steer away from Node if you know your application requires a lot of computing (in other words let’s not try to calculate the 1000th prime number here).

Who’s Getting MEAN?

Many developers have shouted their praise for the MEAN stack. This stack uses JavaScript for every operation, which makes it appealing to developers who want to flow smoothly through a project. Some large companies are already reaping the benefits and have integrated Node into many of their operations.

Walmart

Walmart

Walmart: Walmart began using Node.js in 2012 to provide mobile users with a modern front end experience. Making use of the JavaScript platform, they were able to quickly and easily integrate their existing APIs with their Node application. They also stated that 53% of their Black Friday online traffic went to their Node servers with zero downtime.

Yahoo

Yahoo

Yahoo!: Yahoo started experimenting with Node back in 2010. At first they just used it for small things like file uploads, and now they use Node to handle nearly 2 million requests per minute. They have noted increases in speed and a simpler development process.

Linkedin

Linkedin

LinkedIn LinkedIn began developing the server side of their mobile app entirely with Node. They were previously using Ruby, but since the switch they have seen huge increases in performance, ranging from 2 to 10 times faster.

Paypal

Paypal

PayPal: PayPal has recently jumped onboard and began migrating some of their Java code to Node. They began experimenting with just their Account Overview page, but once they saw a 35% speed increase and half the amount of time spent on development, they started moving all sites to Node.js.

For a larger and maintained list, visit the Node Industry page.