DEV Community

vishwasnarayanre
vishwasnarayanre

Posted on • Edited on

things to regret about node js today

You have only started using Node again in the past 6 months, because when Ryan Dahl created Node the goal was mainly to program event-driven HTTP servers, and Go is a better language for building faster servers.

But he thinks JavaScript is good. Dynamic languages ​​may not be suitable for building servers that you want to control everything, but they are the right tool for prototyping, such as scientific computing. JavaScript is the best dynamic language.

Your Node problem is almost related to the way you manage user code. Mainly because it focuses on event I/O, the module system is essentially an afterthought.

failed to fulfill the promise

  • It is possible that the unified use of promises in Node will speed up the delivery of standardization and async/await.

Security

  • The node program can access all system calls, such as writing to disk and accessing the network.

Build System

  • If you are writing a module link to a C library, you will use GYP to compile the C library and link it to Node.
  • Chrome used to use GYB, but now Node is the only GYP user.
  • Funky interface, which is a Python adaptation of JSON. The node has several unnecessary complex wrappers.

package.json

  • Includes NPM in Node, making NPM a standard for Node distribution. Centralized repository (privately controlled) of modules.
  • require ("sommodule") is not specific: package.json, local node_modules folder, NPM database.
  • promotes the concept of "module" to an unnecessary abstraction of file directories. It does not exist on the network.
  • includes unnecessary information such as licenses, repositories.

node_modules

  • The analysis algorithm for module is extremely complicated.
  • Ventured by default is kind, but $NODE_PATH will work.
  • There is a deviation from the browser.
  • does not need to be extended.

is unnecessarily unclear.

  • is not the way browsers work.
  • The module loader must guess.

index.js

  • It unnecessarily complicates the module loading system.
  • is especially unnecessary after package.json which needs to be supported.

Deno

https://github.com/ry/deno - Official Repo

FreeCodeCamp Study Material

Security

  • By default, the script should run without write access to the network or file system.
  • Users can choose to access via the following signs:
    • allownet
    • allowwrite
  • It is not allowed to bind any native functions to V8.

The TypeScript compiler is built into the executable file.

  • TypeScript is beautiful.
  • finally delivered a practical and optional type language.
  • enables code to grow seamlessly from fast hackers to large, well-structured machines.
  • Normal JS should work too.

The simplified module system does not support node modules.

  • The import is just a relative or absolute URL.
  • The import must provide an extension.
  • remote URLs are fetched and cached indefinitely on the first load.
  • can be sold by specifying a non-default cache directory.

Other

  • Only submit an executable file with the fewest links.
  • Start the runtime by compiling the node module with parcel into a package.
  • Always died immediately because of a promise that was not fulfilled.
  • supports top-level wait.
  • browser compatible (window is not global) #node #deno #javascript

Top comments (1)

Collapse
 
vishwasnarayan5 profile image
vishwasnarayanre

I corrected it