Node. js has quickly benefited from its event-driven and asynchronous features. This article will introduce 10 articles. It has been tested that it can greatly improve the skills of Node applications. Let's take a look at NodeJS one by one as a server-side JavaScript interpreter, which will change the concept of how the server works. It aims to help programmers b
use ". ""... "relative or absolute path starting with". It can have no filename suffix ". js"
2. Implementation Process of the Node Module
In Node, there are two types of modules: one is the core module provided by Node itself, and the other is the file module compiled by the user. Some of the core modules are compile
the same module multiple times and does not load it repeatedly. Node. js caches all loaded file modules based on the file name, so it does not reload the file.
Note: cache by file name refers to the actual file name, and it is not recognized as a different file because of different input paths.
There is a printOutputVal () method in the 1_les_custom_counter file
in path analysis, so its loading speed is the fastest. The file module is dynamically loaded at runtime. It requires complete path analysis, file locating, compilation and execution, and is slower than the core module.
6. During the module loading process, the Node will first load from the cache, And the cache check of the core module takes precedence over the
Node. js asynchronous I/O learning notes, node. js learning notes
The term "Asynchronous" is widely used in the Web 2.0 wave, which swept the Web along with Javascript and AJAX. Asynchronous programming is rare in most advanced programming languages. PHP can best reflect this feature: it not only shields Asynchronizati
This article focuses on the appropriate direction of node. js, what is node. js suitable for? And what are the benefits of node. js? Please see the article for more detailed details.
First, let's talk about what
to check whether the current module is the main module.**/If (module === require. main ){Console. log ("Main module at current module ");}// Output result: the current module is the main module.
// 2. js CodeVar name = "Dr. Sisi ";Console. log (name );Exports. name = name;
// 1. js code:Var two = require ("./2.js? 6.1.3 ");Var two = require ("./2.
means that you need to think about how to build a specific application with these rest interfaces on top. Those back-end programmers don't worry about how specific data is delivered from one page to another, and they don't have to worry about whether user data updates are asynchronously acquired through Ajax or by refreshing the page.3, a large number of Ajax requestsFor example, the personalization application, each user sees the page is different, the cac
as the main module of the application.* You can use the following method to check whether the current module is the main module.**/If (module === require. main ){Console. log ("Main module at current module ");}// Output result: the current module is the main module.// 2. js CodeVar name = "Dr. Sisi ";Console. log (name );Exports. name = name;// 1. js code:Var two = require ("./2.
. Of course, we can also install Node. js through the same steps on ubuntu 14.04.
1) system resourcesThe basic system resources required by Node. js depend on your architecture requirements. In this tutorial, we will perform the installation on a server with 1 GB memory, 1 G
This article gives you a detailed description of the method and step for implementing multi-process using the cluster module in nodejs, which is very detailed and comprehensive. If you need it, you can refer
First, solemnly declare:
NodeJS is a single thread! Asynchronous! Non-blocking language!NodeJS is a single thread! Asynchronous! Non-blocking language!NodeJS is a single thread! Asynchronous! Non-blocking language!
The important thing is said three times. Because
parameters of the require function are neither relative paths nor core module names, Node searches for the Node in the node_modules subdirectory of the current directory, such as the following code, and Node tries to find the file. /node_modules/myModule. js:
The Code is as follows:
Var myModule = require ('mymodule.
parameters of the require function are neither relative paths nor core module names, Node searches for the Node in the node_modules subdirectory of the current directory, such as the following code, and Node tries to find the file. /node_modules/myModule. js:
The Code is as follows:
Var myModule = require ('mymodule.
This article describes how to install Node. JS on Amazon's one-year free plan, NPM, and OurJS Blog system ., For more information, see Debian for the Community edition. The operation commands of Debian and Ubuntu are in the same line, I am familiar with it. The following installation process is also applicable to the installation of node.
This article analyzes node. the use of streamapi in js is described in detail in this article, involving node. jsapi, node. if you are interested in jsstream, refer to this article to introduce node. for details about the js strea
building high-performance, highly scalable Internet applications-because it handles massive and high-throughput concurrent connections.How it works is quite interesting. The traditional Network Service technology, is each new connection (request) will generate a new thread, this new thread will occupy the system memory, will eventually take up all the available memory. While
This article mainly introduces the definition of node. js, as well as a summary of the role of node. js, I hope you learn more, let's come and see this article
First, let's look at what node. js can do.
This is node's more formal
Node. the selling point of js is "asynchronous single-thread". Although many mainstream Web backend programming languages have good support for asynchronous programming, only Node. js forces asynchronous all IO. Python and Ruby also have such a framework, but because it is inevitable to use a library containing Synchro
The fs module of nodejs does not provide a copy method, but we can easily implement one. this method is to read all the file content into the memory and then write the file, this is not a big problem for small text files, such as grunt-file-copy.
I. opening analysis
Stream is an abstract interface implemented by many objects in Node. For example, a request to an HTTP server is a stream, and stdout is also
The fs module of nodejs does not provide a copy method, but we can easily implement one. This method is to read all the file content into the memory and then write the file, this is not a big problem for small text files, such as grunt-file-copy.
I. Opening Analysis
Stream is an abstract interface implemented by many objects in Node. For example, a request to an HTTP server is a stream, and stdout is also
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.