What are common development challenges, pitfalls and suggestions?

I developed at Node.js in just 2 weeks and began to recreate a website previously written in PHP. So far so good, and it looks like I can do the same in Node (using Express), which was done in PHP in the same or less time.

I came across things that you just need to use, for example, using modules, modules not using a common environment, and the habit of using callbacks for file system and database operations, etc.

But is there anything that a developer can discover much later, which is very important for development in node? Problems everyone else has in Node, but they don’t appear until the end? Traps? All that professionals know, and noobs not?

I would be grateful for any suggestions and advice.

+5
source share
1 answer

Here are some things you might not be fully aware of:

  • Node will pause execution to run the garbage collector ultimately / periodically. When this happens, your server will stop on a hiccup. For most people, this issue is not a serious problem, but it can be a barrier to creating systems that work at close range. See Does Node.js Scalability Affect Garbage Failure at High Load?
  • Node is a single process and thus, by default, it will only use 1 processor. There is built-in clustering support to run multiple processes (usually 1 per processor), and for the most part, the Node community believes this is a reliable approach. However, you may be surprised at this reality.
  • - , .

, ( )

  • , callback(null, value) . null , . callback(value), , .
  • return, guard , . , , .

NICE , , ,

  • Node.js , , , , 3 , 2 , 2 HTTP-. Node .
  • Node , API, , . Python , Node cheerio jsdom module python BeautifulSoup , . python requests Node superagent.
  • , , -. Node PHP .
+19

All Articles