Mean

5
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. 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. The MEAN CLI is a simple Command Line Interface for installing and managing MEAN applications. As a core module of the Mean.io project, it provides a number of useful tools to make interaction with your MEAN application easier, with features such as: scaffolding, module creation and admin, status checks, and user management.

description

MEAN

Transcript of Mean

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.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

Angulars 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.

The MEAN CLI is a simple Command Line Interface for installing and managing MEAN applications. As a core module of the Mean.io project, it provides a number of useful tools to make interaction with your MEAN application easier, with features such as: scaffolding, module creation and admin, status checks, and user management.

Users

Information can be display for a specific customer via mean user email. Email is required. User roles can be assigned or removed with the --addRole (or -a) and --removeRole (or -r) options, respectively.

Check the database connection for a particular environment (e.g. development (default), test, production) and make sure that the meanio command line version is up to date.

Packages

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.

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.

Files structure

The file structure is similar to that of the mean project itself

Fundamental Files at the root of the package

Dependency Injection

An injection is the passing of a dependency (a service) to a dependent object (a client). The service is made part of the clients state. Passing the service to the client, rather than allowing a client to build or find the service, is the fundamental requirement of the pattern. WikipediaDependency injection allows you to declare what dependencies you require and rely on the package system to resolve all dependencies for you. Any package registered is automatically made available to anyone who would like to depend on them.

Looking again at the registration example we can see that MyPackage depends on the Tokens package and can make use of its full functionality, including overriding it.

Angular Modules and Dependencies

Every package registration automatically creates a corresponding angular module of the form mean.[package-name]The package system injects this information into the mean init functions and allows developers to base their controllers, services, filters, directives etc on either an existing module or on their own one.

In addition you are able to declare which angular dependencies you want your angular module to use.

Below is an example of adding an angular dependency to our angular module.

// Example of adding an angular dependency of the ngDragDrop to theMyPackage.angularDependencies(['ngDragDrop']);See the assets section for an example how to add external libraries to the client such as the gDragDropjavascript library

Express Routes

All routing to server side controllers is handled by express routes. The package system uses the typical express approach. The package system has a route function that passes along the package object to the main routing file typically server/routes/myPackage.jsBy default the Package Object is passed to the routes along with the other arguments MyPackage.routes(app, auth, database);Example from the server/routes/myPackage.js