PHP中文网2017-04-17 14:49:04
实践
is the best way to learn. If you can apply what you have learned in practice, the efficiency will be much higher than if you don’t practice optically.
Most of the time, the obstacle to learning node is not the node itself, but related 领域知识
.
When encountering problems, learn to use Google, stackflow, and official documents.
What can node do in normal times? You can try the following to practice
工具开发
: Such as web crawler script. After writing this, network request & parsing and web page parsing are basically complete. Don’t find it difficult. There are many mature open source libraries to help you achieve this, such as request and cheerio. The implementation cost of simple web crawlers is very low.
web服务器
: Similarly, there are many mature web frameworks available, such as express. All you need is to use it, add and modify configurations, and add customized content. In the process of using it, as long as you are careful, common modules such as http, fs, stream, url, path, etc. will open the door to you.
It is assumed here that you have mastered js relatively proficiently. Then, in the process of learning, you may encounter many problems. Trust me, 大部分问题并不是node本身的问题,而是相关的领域知识
.
For example, when learning the http module, you will learn the basics of creating a server, port binding, parsing user requests, server-side response, disconnection, etc.
These things will be obstacles for many beginners to learn node. But if you have come into contact with other languages, such as php and python, you will find that they are similar, but the syntax and details will be different.
HTTP itself is an application layer protocol. When you have enough understanding of it, you will get twice the result with half the effort.
Similarly, if you understand the difference between processes and threads, how to communicate between processes, how to create child processes and their differences, then you will be familiar with process and child_process.
The problems you encountered have already been encountered by others. Learn to use Google, stackoverflow, and check the official node documents frequently, and most of the problems will be solved easily
巴扎黑2017-04-17 14:49:04
To make a simple project or a tool to improve daily work efficiency, I use node as an automation tool in the project.