Category: Node.js

0

Publish package

Initialize the basic structure of the package The folder my-package of the new key package, as the root directory of the package In the my-package folder, new key the following three files: pac

0

Package structure

Classification of packages Project package: The packages installed in the node_modules directory of the project are all project packages. Project packages can also be subdivided into two categories:

0

npm and package

Package Third-party modules in Node.js are also called packages (just by a different name). Packages are encapsulated based on built-in modules, providing a more advanced and convenient API, which g

0

Loading mechanism of module

Prioritize loading from cache Modules are cached after the first load. This means that multiple calls to require() will not cause the module’s code to be executed multiple times. Whether it is a bui

0

Share members in module

module object In each .js custom module there is a module object, which stores information about the current module. After printing there is: 1234567891011121314151617Module { id: '.

0

Modularization

Modular Concept Modularization refers to the process of dividing the system into several modules layer by layer from top to bottom when solving a complex problem. For the entire system, modules are

0

Http module

http module The http module is officially provided by Node.js and is used to create a web server module. Through the http.createServer() method, you can easily turn an ordinary computer into a Web s

0

Split file example, Regex

Case Requirements The file that needs to be split is an index.html file with HTML, style, and JS code mixed together. The requirement is to split this mixed file into three files, index.html, index.

0

Path route module

path path module The path module is officially provided by Node.js and is used to process paths. It has methods for dealing with paths, such as path.join() to join paths, path.basename() to parse fi

0

Dynamic route combine

The reason for the problem with the path When using the fs module to operate files, if the provided operation path is relative path starting with ./ or ../, the problem of dynamic path splicing erro