Node.js Package Manager

The huge number of modules available today makes it easy to start developing any kind of application or service, and npm ensures you're able to deploy your code in other servers easily. In fact, npm is also one of the advantages of Node.js and is also responsible for its spread.

# look how fast it checks dependencies (infinite levels), downloads them
# and installs them locally

$ npm i express
+ [email protected]
added 48 packages in 3.129s

There has always been some criticism about using Node.js, with people considering it slow and inefficient for some tasks. Some usually point to the fact that the code is single-threaded, but forget that the core API, which is your only way of communicating over the network or with the filesystem, uses a thread pool of workers to handle your actions:

const http = require("http");

// request is done in a separate thread, code execution continues
http
.request("http://www.google.com")
.once("response", (res) => {
console.log(res.headers);
})
.end();

console.log("getting google.com headers..");
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset