MEAN is a framework for an easy starting point with MongoDB, Node.js, Express, and AngularJS based applications. It is designed to give you a quick and organized way to start developing MEAN based web apps with useful modules like Mongoose and Passport pre-bundled and configured. We mainly try to take care of the connection points between existing popular frameworks and solve common integration problems.

MEAN stands for:

MongoDB

MongoDB is the leading NoSQL database, empowering businesses to be more agile and scalable.

Express

Express is a minimal and flexible node.js web application framework, providing a robust set of features for building single and multi-page, and hybrid web applications.

AngularJS

AngularJS lets you extend HTML vocabulary for your application. The resulting environment is extraordinarily expressive, readable, and quick to develop.

Node.js

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications.
Prerequisite Packages
Mean currently works with either grunt or gulp.

$ npm install -g gulp
// and bower
$ npm install -g bower

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

Install the MEAN CLI
$ 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 –

$ gulp

Alternatively, when not using gulp (and for production environments) you can run:

$ node server

Then, open a browser and go to:

http://localhost:3000

TECHNOLOGIES USED

The MEAN Stack

MEAN is an acronym for Mongo, Express.js , Angular.js and Node.js.
MongoDB : Go through MongoDB Official Website and proceed to its Great Manual, which should help you understand NoSQL and MongoDB better.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 : Angular’s Official Website is a great starting point. CodeSchool and google created a great tutorial for beginners, and the angular videos by Egghead.Node.js: Start by going through Node.js Official Website and this StackOverflow thread, which should get you going with the Node.js platform in no time.
[See Also: Newbie Guide to JavaScript]

ADDITIONAL TOOLS

  • Mongoose – The mongodb node.js driver in charge of providing elegant mongodb object modeling for node.js
  • Passport – An authentication middleware for Node.js which supports authentication using a username and password, Facebook, Twitter, and more.
  • Twitter Bootstrap – The most popular HTML, CSS, and JS framework for developing responsive, mobile first projects.
  • UI Bootstrap – Bootstrap components written in pure AngularJS

PACKAGES OF MEAN

Everything in mean.io is a package and when extending mean with custom functionality make sure you create your own package and do not alter the core packages.

The mean.io package system allows developers to create modular code that provides useful tools that other mean developers can use. The packages, when published, are plug-and-play and are used in a way very similar to traditional npm packages.

The mean.io package system integrates all the packages into the mean project as if the code was part of mean itself and provides the developers with all the necessary tools required to integrate their package into the host project.

There are two types of packages:

Custom Packages are generated by the mean scaffolder and contain most of your application logic. Custom packages are found in /packages/custom and can be published as a contrib package for use by other developers.

Contrib Packages are installed by the mean installer and are found at /packages/contrib. Contrib packages are “plug and play”.

[See Also: How to Tell If You’ve Been Pwned]

CORE PACKAGES

All Core packages can be overridden by other packages allowing you to extend and adapt it to fit your specific needs. See Overriding views for detailed examples.

System: The “system” package creates the basic pages as well as defines the layout of the site and integrates the menu into the page. The system package also allows us to define things such as rendering engines, static files and routing on the client and server side.

Users: The “users” package creates the database model of the user, provides validation as well as various login and registration features.

Access: The “access” package manages permissions and middleware. It controls the various authentication methods and is dependent on the users package

Theme: The “theme” package adds some basic CSS and other assets such as images and backgrounds

Articles: The “articles” package is typically used as an example starting point for managing content that might be used in a blog or cms. The full CRUD is implemented on the server and client.

FILE STRUCTURE OF MEAN

Server

Packages are registered in the app.js. Define package name, version and mean = true in the package.json

All of the Server side code resides in the /server directory.
— config # Configuration files
— controllers # Server side logic goes here
— models # Database Schema Models
— routes # Rest api endpoints for routing
— views # Swig based html rendering

Client

All of the Client side code resides in the /public directory.

— assets # JavaScript/CSS/Images (not aggregated)
— controllers # Angular controllers
— config # Contains routing files
— services # Angular services (also directive and filter folders)
— views # Angular views

All JavaScript within public is automatically aggregated with the exception of files in public/assets, which can be manually added using the aggregateAsset() function.

Files within the public directory of the package can be accessed externally at /[package-name]/path-to-file-relative-to-public. For example, to access the Tokens Angular controller,tokens/controllers/tokens.js.

Everything you need to know about outsourcing technology developmentAccess a special Introduction Package with everything you want to know about outsourcing your technology development. How should you evaluate a partner? What components of your solution that are suitable to be handed off to a partner? These answers and more below.

Introduction Package

Source: zymr

This article was authored by Parshva Mehta, who is a Software Engineer at Zymr.

0 comments

Leave a Reply

© 2019, Zymr, Inc. All Rights Reserved.| LEGAL DISCLAIMER | PRIVACY POLICY | COOKIE POLICY