Preface
Node.js is now well into its second decade and has significantly matured as a technology. Today, it is a common technology of choice for building applications of all sizes. Many large enterprises use Node.js in production, including the likes of Netflix, PayPal, IBM, and even NASA. Due to the widespread usage and dependence on Node.js, it was moved under the OpenJS Foundation (formerly the Node.js Foundation). The OpenJS Foundation provides a neutral home for JavaScript projects, with a strong focus on open governance.
Created in 2009, Node.js wrapped Google Chrome’s JavaScript Engine, V8, to enable JavaScript to be run outside the browser. Node.js brought JavaScript to the server and was built following an event loop architecture, which enables it to effectively handle input/output and concurrent operations. Today, Node.js is a popular technology choice for building many types of applications, including HTTP web servers, microservices, command-line applications, and more. The key to Node.js’s success is that it enables full-stack development in a common language, JavaScript.
The massive ecosystem of Node.js modules has supported Node.js’s success. There are now over three million modules available on the npm
registry, with many abstracting lower-level implementation details to higher-level and more easily consumable APIs. Building your applications atop npm
modules can speed up the development process while promoting code sharing and reuse.
In recent years, Node.js has seemingly moved away from its small core philosophy, providing a more “batteries included” runtime. This evolution includes the adoption of more features into the core runtime, such as a built-in test runner, enhancing its out-of-the-box developer experience.
Node.js Cookbook, Fifth Edition is an updated version of Node Cookbook, Fourth Edition. The content has been updated in line with the latest long-term supported version of Node.js, Node.js 22. This edition covers some of the new features incorporated into the runtime, including the built-in test runner.