node. JS learns a

Source: Internet
Author: User

node. JS is a platform that allows JavaScript to run on the server side. node. JS is a platform created for real-time Web application development that takes into account the scalability of the architecture in real-time response/hyper-scale data requirements. It uses a single-threaded, asynchronous stone IO, event-driven design pattern.

node. JS has a powerful and flexible Package Manager (Node Pack manager) NPM

node. JS Architecture Design: 1, asynchronous I/O, event-driven

2,V8 engine as JavaScript engine

3, efficient Libev event-driven library

4, efficient Libeio asynchronous I/O Library


Commonjs:javascript Specification API

node. js's event loop mechanism:

node. JS's program starts with the event loop, ends with the event loop, all the logic is the callback function of the event, so node. js is always in the event loop, and the program entry is the callback function for the first event in the event loop. For the event loop graph


node. JS provides the Require function to invoke other modules, and the modules are based on the file system, and the mechanism is simple.

What is a module: The module is a basic part of node. JS's application, and the files and modules are one by one corresponding. In other words, a node. js file is a module that may be a JavaScript code, JSON, or a compiled C + + extension.

node. JS provides the exports and require two objects, where exports is the interface that the module exposes, and require is the interface to get a module externally, which is the exports object of the acquired module.

Single load: Require does not load the module repeatedly, that is, the modules obtained are the same regardless of how many times require are called.

Express Architecture:


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.