What is MEAN? What does MEAN in JavaScript programming ?, Javascriptmean

Source: Internet
Author: User

What is MEAN? What does MEAN in JavaScript programming ?, Javascriptmean

Some days ago I saw an article about MEAN. What is MEAN?

In fact, MENA is the abbreviation of MongoDB (non-Relational Database) + Express (template engine) + AngularJS (MVC javascript Library) + NodeJS (server script.

They jointly construct javascript-based modern web application full-stack development tools.

MongoDB:

It is a powerful, flexible, and Scalable Data Storage Method.

It extends many useful functions of relational databases, such as secondary indexes, range queries, and sorting, its built-in support for MapReduce-type aggregation, and its support for geospatial indexes.

It replaces the concept of the traditional database row with the document model, which is actually an array object.

Let's take a look at the document model:

{"_ Id": 1, "greeting": "hello, world !" , "Foo": 3}

Each document has a _ id field. This document model indicates that there is a record in the database, including the greeting, foo, and _ id fields;

Express:

I would like to describe the last engine Express in one sentence:

Is a simple and flexible node. js Web application framework that provides a series of powerful features to help you create various Web applications.

A wide range of HTTP tools and middleware from the Connect framework can be used as needed. Creating Strong and friendly APIs becomes fast and simple.

Express does not provide secondary abstraction for the existing features of node. js. We just extend the functions required by Web applications.

AngularJS:

AngularJS is a js library developed by google. It is the same as the backone MVC script library.

The first lesson in almost every language is about hello world. We also come to the following Convention:
Copy codeThe Code is as follows:
<! Doctype html>
<Html ng-app>
<Head>
<Script src = "http://code.angularjs.org/angular-1.0.1.min.js"> </script>
</Head>
<Body>
Hello {'World '}}!
</Body>
</Html>

<Html ng-app>

Declared that angularJS is used for the page. When the page is loaded, ng-app is marked to tell AngularJS to process the entire HTML page and guide the application.
This example prints hello world on the page. Some people are wondering why hello world is so complicated.

In fact, the content in {} is a form of data binding. After reading the next example, you will know its strength.

Next, let's look at the next example:
Copy codeThe Code is as follows:
<! Doctype html>
<Html ng-app>
<Head>
<Script src = "angular-1.0.1.min.js"> </script>
</Head>
<Body>
Your name: <input type = "text" ng-model = "yourname" placeholder = "World">
<Hr>
Hello {yourname | 'World '}}!
</Body>
</Html>

Open this page in the browser and try to enter any characters in the input box. You will find that these entered characters are immediately updated and displayed in the greeting. Is it amazing?

. Any changes in the input box are immediately reflected in the model variable (in one direction), and any changes to the Model Variable are immediately reflected in the greeting text (in another direction ).

This example has the following important notes:

1. Bind The text input command <input ng-model = "yourname"/> to a model variable named yourname.

2. Add the yourname model variable to the greeting text with double braces.

3. You do not need to register an event listener for the application or add an event handler!

NodeJS

It is a high-performance server js platform developed by Ryan Dahl.

It is developed on the V8 engine. The V8 engine is a javascript engine developed by google. It is not a V8 engine of a car-it is a high-performance engine, and its performance far surpasses that of other scripting languages.

NodeJS uses asynchronous I/O communication, which is similar to AJAX:
Copy codeThe Code is as follows:
$. Post ("url", {title: "post request"}, function (data ){
Console. log ("receive response ");
})
Console. log ("sending ajax ends ");

Nodejs request method:

Copy codeThe Code is as follows:
Var fs = require ('fs ');
Fs. readFile ("/path", function (err, file ){
Console. log ("File Reading completed ");
});
Console. log ("initiate file reading ");

Let's look at the following example:

When two requests are executed at the same time, the total time consumed depends on the one that consumes the most time, rather than the sum of the time consumed by the two requests because the two are in parallel.

Copy codeThe Code is as follows:
// The first request
Var fs = require ('fs ');
Fs. readFile ("/path1", function (err, file ){
Console. log ("reading file 1 completed ");
});
// Second request
Fs. readFile ("/path2", function (err, file ){
Console. log ("reading file 2 completed ");
});
Console. log ("initiate file reading ");

Another reason for nodejs's high performance is event-driven:

Node introduces the events in the browser to the backend, and uses asynchronous I/O to expose the event points to the business logic.

The event conversion method is lightweight, loosely coupled, and focuses only on transaction points.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.