Fun fact about us: Rheinwerk Publishing has branches in both Bonn, Germany, and Boston, Massachusetts. The benefit of this international setup is that we can publish both German-language books and English-language booksthe challenge is translating them.
When our colleagues at Rheinwerk Verlag in Bonn publish a book that we would also like to provide to English-speaking readers, or vice versa, the manuscript undergoes the translation process. This means that either the author, or a third party, must translate every sentence, diagram, and piece of code. However, receiving the translated manuscript several months later isnt the end of the story. Both the author and the editor must review and fine-tune the manuscript: the author ensures no errors have been introduced, and the editor realigns any variations in our formatting standards. Then, the copyeditor edits each chapter line-by-line to polish the grammar and style in the books new language.
Node.js: The Comprehensive Guide is one of these translations, brought to you from its fourth German edition. Ironically, the topic of this book, Node.js, is the solution for this translation process in the programming world. Node.js allows your client- and server-side scripts to be written in a single language: JavaScript. In these pages, youll find the instructions and practical examples you need to make the most of the Node.js environment for unified web application development.
What did you think about Node.js: The Comprehensive Guide ? Your comments and suggestions are the most useful tools to help us make our books the best they can be. Please feel free to contact me and share any praise or criticism you may have.
Notes on Usage
This e-book is protected by copyright . By purchasing this e-book, you have agreed to accept and adhere to the copyrights. You are entitled to use this e-book for personal purposes. You may print and copy it, too, but also only for personal use. Sharing an electronic or printed copy with others, however, is not permitted, neither as a whole nor in parts. Of course, making them available on the internet or in a company network is illegal as well.
For detailed and legally binding usage conditions, please refer to the section .
This e-book copy contains a digital watermark , a signature that indicates which person may use this copy:
Notes on the Screen Presentation
You are reading this e-book in a file format (EPUB or Mobi) that makes the book content adaptable to the display options of your reading device and to your personal needs. Thats a great thing; but unfortunately not every device displays the content in the same way and the rendering of features such as pictures and tables or hyphenation can lead to difficulties. This e-book was optimized for the presentation on as many common reading devices as possible.
If you want to zoom in on a figure (especially in iBooks on the iPad), tap the respective figure once. By tapping once again, you return to the previous screen. You can find more recommendations on the customization of the screen layout on the .
Preface
Node.js has been with me for many years now as a server-side development platform and also in the form of this book, which is now in its fourth edition in German and debuting with this first edition in English. Over time, the JavaScript world, and also Node.js itself, has changed a lot. Node.js has now grown up and is part of the mainstream. In contrast to the early days, when you had to convince funders, decision makers, and coworkers to use Node.js, it has become much easier now. In some cases, Node.js is already used as the base platform in projects. One aspect that has contributed decisively to this success story is the flexibility of the platform. You can use Node.js in small command-line tools, for building rapid prototypes, and also for large-scale server applications in an enterprise context. This book is intended to accompany you on your journey into the world of Node.js, to help you get started developing applications based on Node.js, and to serve as a reference in your daily work.
In this book, you'll learn the basics of Node.js, learn more about how the platform is built, and work with the various interfaces that Node.js makes available to you.
Note that to work with this book, you should have a solid basic knowledge of JavaScript. While I do cover some language features throughout this book, such as destructuring, promises, and the module system, the focus is on Node.js, and so you should take a look at the Mozilla Developer Network ( https://developer.mozilla.org/de/ ), which comprehensively explains all aspects of JavaScript. I would also like to take this opportunity to recommend Philip Ackermanns JavaScript: The Comprehensive Guide (SAP PRESS, 2022, www.rheinwerk-computing.com/5554 ).
Server-side JavaScript with Node.js differs in some aspects from developing client-side applications with HTML, CSS, and JavaScript, so you usually dont have direct visual feedback like you are used to in the browser. The architecture and design patterns you use on the server side also differ to some extent from those on the client side. Other patterns and paradigms are the same on both sides. Thus, Node.js is event-driven in many places, similar to the browser. This means that you have a lot to do with asynchronous operations because your application in Node.js usually runs in a single process, and performance bottlenecks can easily occur here if different operations block each other.
Node.js uses the same JavaScript engine as the Chrome browser: the V8 engine. Since the Node.js development team always keeps the engine up to date, you can develop modern JavaScript with Node.js and also have access to the latest language features. In addition to the engine, Node.js provides you with an extensive collection of core modules that you can use to solve your problems relatively close to the system level. However, youll usually use external packages because, for most problems, there are already established solutions that you only need to adapt for your application. The module system of Node.js takes a prominent position here. A lot has happened in this area in recent years, and the platform has taken a big step forward in adapting the ECMAScript module system. Throughout this book, youll learn more about the different layers of the module system and how you can use it to build your application.