What do you think nodejs has more important knowledge points?

  node.js, question

What do you think nodejs has more important knowledge points?

I think nodejs should be divided into two departments, one is JS and the other is node api.
JS at the language level is very important. Understanding prototype chain, lexical scope (closure) and built-in methods of Object/Array/Function are all necessary and cannot be skipped.

Also, the promise to simplify callback and the generator yield brought by ES6 are all language related and should be familiar with.

On node’s side, I think the following points are more important:
1. The request and response of http network requests, the first demonstration on node demo is an HTTP output hello world, so it can be seen that the focus of node.js lies in the web server, especially HTTP, which is also the reason why the two concepts of req and res are so important.

2.buffer, node.js is relatively friendly to IO due to its naturally asynchronous relationship. buffer is actually used for data flow service. In many IO inside, data will be represented by buffer. You should know to use buffer. CONCAT (buffer ARR) to assemble buffer instead of plus sign. You should understand the coding rules of buffer and several forms of toString.

There is also a coding problem involved here. In theory, after buffer is obtained, it can be analyzed with any text coding. This concept is more important when collecting.

3. Event cycle. To understand the asynchrony of node.js, you need to know something about the event cycle. You should know something about the timer function and fs inside event scheduling implemented by node. If you have time, you can also catch up with libuv. It is the encapsulation of IO asynchrony of the operating system.

4.stream, since it is IO, the concept of stream is inevitable. This concept is common in all IO inside. You should have an understanding of several types of STREAM and know how the push operation is completed inside the stream. For example, a. data () that receives an active stream can also stop it and read it by itself ().

There is also a proper understanding of pipe. Don’t leave pipe behind. It is asynchronous.

5.cluster, you should have some knowledge about multi-processes, know that cluster is the combination of Child Processes and net, know how to communicate with each other between processes, and how to keep the state synchronized.

6.UDP/TLS/SSL, these places more emphasis on the network side. If https is to be set up, the relevant contents must be mastered. node already has a lot of api, which is generally enough to use.

There are still some left, such as vm module (for sandbox code execution), os module (to obtain basic information of the current executing machine), path, dns, etc., which need to be mastered when used. .

Third parties also have many things to use, such as rendering templates, ORM and packaged tool modules. Third parties such as async, which are used for serial and parallel asynchronous tasks, should understand.