What is MEAN?

The MEAN stack is comprised of four pieces of software:

  • MongoDB - Stores JSON Objects
  • ExpressJS - Service Side JavaScript
  • AngularJS - Client Side JavaScript
  • NodeJS - Service Side JavaScript

Since every component of the stack uses JavaScript, we can glide through our web development code seamlessly. If we use Facebook’s React Native we can even create our mobile and web applications with JavaScript!

Lets get Started!

Requirements

Tools

Starting Node

We’re going to start with a simple project.

  • Make a new folder mkdir hello-world
  • Jump into that folder cd hello-world
  • Start our node project npm init

For now we can keep everything default except for the entry point which we’ll change to server.js. Our directoy will now be filled with a new filed called package.json.

package.json

Node projects are configured within package.json. Our new file should look like this:

{
"name": "hello-world",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}

It’s okay to delete everything we don’t need for our sample project.

{
"name": "hello-world",
"main": "server.js"
}

Creating our sample project

Our project is currently missing a file, so go ahead a create a new filed named server.js. Inside we’re going to tell our Node App to send a message to the console.

Inside server.js type in the following code:

console.log('Hello world!');

Running our sample project

Now that we’ve finished writing our sample project, we can run it by typing in node server.js inside the terminal.

Congrats! You’ve just set up your first Node Project!

Homework

Spent some time learning more about the Console in the Node Documentation

You can find the sample code for this project here.