Mean Stack Development[For Developers]

Written by ontoborn | Published 2017/03/23
Tech Story Tags: nodejs | javascript | angularjs | mean-stack | mongodb

TLDRvia the TL;DR App

Mean Stack

MEAN stack is basically a collection of JavaScript-based web development technologies that includes MongoDB, ExpressJS, AngularJS and NodeJS. Following diagram clearly explains that how these technologies work together to develop a web application. AngularJS being client makes AJAX calls to ExpressJS returning response in JSON format. ExpressJS that is running on NodeJS Server further communicate with MongoDB as persistent medium (a NoSQL database).

Why MEAN Stack?

The acronym “MEAN” stands for “MongoDB Express.js AngularJS Node.js” and represents a group of technologies which are known to synergize well together. The major benefit of the MEAN stack is that it’s extremely quick to prototype with. Node.js allows you to use Javascript on the backend as well as the frontend which can save you from having to learn a separate language. In addition, the NoSQL nature of MongoDB allows you to quickly change and alter the data layer without having to worry about migrations, which is a very valuable attribute when you’re trying to build a product without clear specifications. Finally, these technologies have a lot of community support behind them so finding answers to questions or hiring help is going to be much easier using these technologies.

Introduction

MONGODB

MongoDB is a cross-platform, document oriented database that provides, high performance, high availability, and easy scalability. It works on concept of collection and document.

MongoDB is, a kind of NoSQL database. As a NoSQL database, MongoDB shuns the relational database’s table-based structure to adapt JSON-like documents that have dynamic schemas which it calls BSON. This makes data integration for certain types of applications faster and easier.

Go through MongoDB Official Website and proceed to its Great Manual, which should help you understand NoSQL and MongoDB better.

EXPRESS.JS

Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and also mobile applications. Express.js and Node.js gave JavaScript newfound back-end functionality — allowing developers to build software with JavaScript on the server side for the first time. Together, they make it possible to build an entire site with JavaScript: You can develop server-side applications with Node.js and then publish those Node.js apps as websites with Express.

The best way to understand express is through its Official Website, particularly The Express Guide; you can also go through this StackOverflow thread for more resources.

ANGULARJS

AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML’s syntax to express your application’s components clearly and succinctly. AngularJS’s data binding and dependency injection eliminate much of the code you would otherwise have to write. And it all happens within the browser, making it an ideal partner with any server technology.

Angular’s Official Website is a great starting point. CodeSchool created a great tutorial for beginners, and the angular videos by Egghead.

NODE.JS

Node.js® is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. It’s package ecosystem, npm, is the largest ecosystem of open source libraries in the world.

Node.js is a cross-platform runtime environment and has also library for running JavaScript applications outside the browser. Node is used for creating server-side and networking web applications. It is open source and free to use

Start by going through Node.js Official Website and the documentation page as well as this StackOverflow thread, which should get you going with the Node.js platform in no time.

Prerequisite Technologies

### Linux * Node.js — Download and Install Node.js, nodeschool has also free node tutorials to get you started. We recommend node-4.x as the preferred node version to run mean.io. * MongoDB — Download and Install mongodb — Checkout their manual if you’re just starting.

If you’re using ubuntu, this is the preferred repository to use.

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

  • Git — Get git using a package manager or download it.

WINDOWS

  • Node.js — Download and Install Node.js, nodeschool has free node tutorials to get you started.
  • MongoDB — Follow the great tutorial from the mongodb site — “Install Mongodb On Windows”
  • Git — The easiest way to install git and then run the rest of the commands through the git bash application (via command prompt) is by downloading and installing Git for Windows

OSX

Prerequisite packages

  • Mean currently uses gulp as a build tool and bower to manage frontend packages. $ npm install -g gulp // and bower $ npm install -g bower

Installation

To start with MEAN install the mean-cli package from NPM. This will also add the mean command which lets you interact (install, manage, update …) your Mean based application.

INSTALL THE MEAN CLI

In linux install in globally as root

bash $ sudo npm install -g mean-cli $ mean init <myApp> $ cd <myApp> && npm install

INVOKE NODE WITH A TASK MANAGER

Mean supports the gulp task runner for various services which are applied on the code. To start your application run — bash $ gulp

Alternatively, when not using gulp (and for production environments) you can run: bash $ node server Then, open a browser and go to: bash http://localhost:3000

RUNNING ON A DIFFERENT PORT

If you have a rails, node, or other MEAN project already running, you may need to use a different port. You can set the port and start your new MEAN project with one command: bash $ export PORT=3001 && gulp

Then, open a browser and change the port number before you visit: bash http://localhost:3001

UPDATE NPM, BOWER OR GULP

Sometimes you may find there is a weird error during install like npm’s Error: ENOENT. Usually updating those tools to the latest version solves the issue.

  • Update NPM: bash $ npm update -g npm
  • Updating Gulp: bash $ npm update -g gulp
  • Updating Bower: bash $ npm update -g bower

CLEANING NPM AND BOWER CACHE

NPM and Bower has a caching system for holding packages that you already installed. We found that often cleaning the cache solves some troubles this system creates.

  • NPM Clean Cache: bash $ npm cache clean
  • Bower Clean Cache: bash $ bower cache clean

Mean Stack Development Tutorials

Want to learn Mean Stack development quickly . You can find few resources here

https://github.com/ericdouglas/MEAN-Learning

Mean Stack Tutorial - Beginners Tutorial_A MEAN stack tutorial where you wil build a real-world application. The tutorial is for beginners and will get you…_www.bradoncode.com

Hiring MEAN stack developers

If you would like to hire mean stack developers please visit us here

http://ontoborn.com/

References

http://mean.io/


Written by ontoborn | We are a software engineering startup. We help non tech startup entrepreneurs build their software products
Published by HackerNoon on 2017/03/23