Cloud Application Development Services India

Getting started with MEAN stack

This is a basic introduction to get started with MEAN stack.

You should also check out other more advanced work flows using MEAN stack for a production run.

You’ll have to install some dependencies before you can actually install MEAN stack. For this purpose I’m assuming you’ll be running a linux development machine. Although windows should work fine. You should be having sudo permission on your linux machine.

I highly recommend a 64 bit OS.

Introduction

At its core Mean stack is but a set of configuration documents to be executed by Node. Read this introduction on MEAN stack.

Its a construct.

It has the configuration needed to work with Express.js, Mongodb and Angular.js.

It lets you organize and order your code by a set convention.

Loads of developer tools to work through the development phase.

Node

Node is a JavaScript run time environment. It just runs any js file you give it to execute.It can be any thing not just a web application. This means you can run a JS file anywhere not just a browser you can manage to install Node.

The installations are best at the Node official site 

Be sure to get the stable version (not necessarily the latest) from the site. 4.X at the time of writing.

Open up your terminal.


curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs


sudo apt-get install -y build-essential

We do need the build tools.

The -y flag tells apt to silently install the package.

Check the node installation

$ node -v

and

$ npm -v

at command prompt. You should see something like

v4.x.x

depending on version selected.

Common errors in Node installation is permission issues, make sure you have sudo permission and write permission to root.

Mongodb

More detailed instructions at mongodb official site.

Your server needs to know about the mongodb package and its sources.

Be sure to use the version specific to your installation.  – the following is for ubuntu 12.04 64 bit.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update

Install Mongodb

sudo apt-get install -y mongodb-org

Check for installation

$ mongo

it should give you the installed version number, connection status, and a mongodb command prompt

See this post to Mongodb Management.

MEAN

Mean stack construct provides a good number of developer tools accessible by grunt or gulp. These are task runners.

Gulp comes with the stack. You should install Grunt if you prefer that to Gulp.

$ npm install -g grunt-cli

Install Bower

Bower is a front end package manager.

$ npm install -g bower

Now we are ready for MEAN.

Create a working directory

Download MEAN from Git repo

$ git clone https://github.com/meanjs/mean.git meanProj
$ cd meanProj/
$ npm install

This should take a while. NPM now brings all the packages listed in packages.json file in the downloaded sources and installs them locally in the project folder.

You will probably see errors is the installation process due to some missing dependency packages. You’ll have to install these missing packages and try npm install again.

NPM will also run ‘bower install’ for front end dependencies.

You should see a success output in your command prompt once the installation is done.

you can now start your meanProj app by running

$ grunt