↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

Seven Things You Should Stop Doing with Node.js

The post argues that several common Node.js habits should be dropped in favor of clearer or safer alternatives. It recommends async control flow tools for nested work, exact package versions in package.json, real debuggers instead of console.log, REST verbs beyond GET and POST, optional semicolons, avoiding comma-first style, and raising or disabling the default socket limit.

Reading notes
#

  • Stop nesting multiple callbacks when async.series() or async.waterfall() can structure the flow more clearly.
  • Use exact version numbers in package.json instead of * to avoid third-party updates breaking the app.
  • Prefer a debugger such as Node Inspector over console.log when inspecting values and stepping through code.
  • Use PUT and DELETE for updates and deletions instead of sending everything through GET and POST.
  • Semicolons are optional in Node.js JavaScript because of automatic semicolon insertion, though the post notes two cases where they matter.
  • The post rejects comma-first style and argues that it looks awkward compared with a more traditional line ending style.
  • The default maxSockets value is 5, so it suggests increasing it, setting it to Infinity, or disabling pooling with agent: false.