Before you get started, I’ll discuss Node.js and what you’ll learn in this book.
According to the Node.js website (https://nodejs.org/en/about/), Node.js is “an asynchronous event driven JavaScript runtime.” Let me break down that definition. Node.js reads, or interprets, your JavaScript code. You write code in JavaScript and then use your version of Node.js to run the code. How does that process work, exactly?
The Node.js runtime uses a JavaScript engine, a program that reads JavaScript code and executes its commands on the fly. Specifically, Node.js uses Google’s Chrome V8 Java-Script engine, an open-source interpreter that converts JavaScript to machine code—code that your computer can readily execute. This feature is useful because Google often updates and monitors its JavaScript engine for use in its Chrome web browser, where JavaScript engines traditionally run. Node.js adapts this engine to provide an environment for you to run JavaScript code that doesn’t require a web browser. Now, instead of reserving JavaScript for scripting on web pages, you can use it to build an entire application on the server (see unit 1).
Defining the terms asynchronous and event driven is important, as they’re fundamental elements of how JavaScript is used nowadays. Understanding their impact on Node.js applications is more important, however.