The relationship between CommonJs and NodeJs

What is CommonJs?

​ JavaScript is a powerful object-oriented language, it has many fast and efficient interpreters, but the API defined by the JavaScript standard is to build browser-based applications, and does not customize a standard library for a wider range of applications. The commonJS specification is mainly to make up for the lack of a standard library in JavaScript. Its ultimate goal is to provide a standard library similar to Python, Ruby and Java language, not just let JavaScript stay at the stage of small script programs. Applications written with CommonJS API can not only use JavaScript to develop client applications, but also the following applications.

  • The JavaScript application on the server side. (NodeJS)

  • Command line tool.

  • Desktop graphical interface application.

    CommonJS is the standard of modularity, and nodejs is the realization of CommodJS (modularity).

Modularity in NodeJS

The Node application is composed of modules and adopts CommonJS module specifications
  1. ​ In node, modules are divided into two categories

    One is the module provided by Node, called the core module ; the other is the user-written module, called the file module .

Guess you like

Origin blog.csdn.net/qq_39208971/article/details/109025337