What is mean? What does the mean in JavaScript programming mean? _node.js

Source: Internet
Author: User
Tags event listener mongodb readfile

A few days ago saw an article mentioned mean this word, what is mean?

In fact, MENA is the abbreviation for the MongoDB (non relational database) + Express (template engine) + Angularjs (MVC JavaScript Library) + Nodejs (server script).

Together, they construct a modern web application full stack development tool based on JavaScript.

Mongodb:

is a powerful, flexible, scalable way to store data.

It expands the many useful features of relational databases, such as secondary indexes, scope queries, and sorting, its built-in support for MapReduce aggregation, and support for geospatial indexing.

It replaces the concept of the traditional database row (row) with the document model, which is the so-called 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 comes with a _id field that represents a record in the database, including fields greeting, Foo, and _id;

Express:

About the last class engine express, I would like to use a sentence to describe it:

is a concise and flexible node.jsweb application framework that provides a range of powerful features to help you create Web applications.

Rich HTTP tools and middleware from the Connect framework with access, creating robust, friendly APIs becomes fast and easy

Express does not have two abstractions of node.js existing features, we just extend the functionality required for Web applications on top of it

Angularjs:

Angularjs is a JS library developed by Google, and it is the same as the MVC Script Library as Backone.

The first lesson in almost every language is the Hello World, and we do it by convention:

Copy Code code as follows:

<!doctype html>
<script src= "Http://code.angularjs.org/angular-1.0.1.min.js" ></script>
<body>
Hello {' World '}}!
</body>

Declares that the page uses Angularjs, and when the page is loaded, the tag Ng-app tells Angularjs to process the entire HTML page and to boot the application.
This example is printed on the page Hello World, some people are strange, hello world is so complicated.

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

Next, we'll look at an example:

Copy Code code as follows:

<!doctype html>
<script src= "Angular-1.0.1.min.js" ></script>
<body>
Your Name: <input type= "text" ng-model= "yourname" placeholder= "World" >
Hello {{Yourname | | ' World '}}!
</body>

Open the page in the browser and try typing random characters in the input box, and you will notice that these characters are immediately updated and displayed in the greeting. Isn't it amazing?

's thoughts. Any changes to 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 (the other side).

The example has several important considerations:

1. The text input instruction <input ng-model= "yourname"/> bound to a model variable called Yourname.

2. Double brace tags add yourname model variables to the greeting language book.

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

Nodejs

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

It is developed by the V8 engine, the V8 engine is a JavaScript engine developed by Google, not a car's V8 engine –-is a high-performance engine, and its performance goes well beyond other scripting languages.

Nodejs uses asynchronous I/O to communicate in a way that is similar to Ajax:

Copy Code code as follows:

$.post ("url", {title: "POST Request"}, function (data) {
Console.log ("received response");
})
Console.log ("Send Ajax End");

Nodejs Request Method:

Copy Code code as follows:

var fs = require (' FS ');
Fs.readfile ("/path", function (err, file) {
Console.log ("Read file complete");
});
Console.log ("initiating read file");

Let's look at the following example:

When executing two requests at the same time, the total time consuming depends on the most time-consuming, not the total of the two requests, because the two are parallel.

Copy Code code as follows:

First request
var fs = require (' FS ');
Fs.readfile ("/path1", function (err, file) {
Console.log ("Read file 1 complete");
});
A second request
Fs.readfile ("/path2", function (err, file) {
Console.log ("Read file 2 complete");
});
Console.log ("initiating read file");

Another reason for Nodejs performance is event-driven:

Node introduces events from the front-end browser to the backend, with asynchronous I/O, exposing the event points to the business logic.

The way events turn out to be lightweight, loosely coupled, focusing only on the advantages of things.

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.