In this chapter, I’d like to paint the big picture: What are you learning in this book and how does it fit into the overall landscape of web development?
5.1. What are you learning in this book?
Node.js is important for web development in three ways:
Node’s software registry, npm, has become the dominant way of installing tools (such as compilers and build tools) and libraries – even for client-side development.
5.2. The structure of browsers and Node.js
Two APIs are hosted on top of this foundation:
In browsers, you need to use the platform-specific API if you want to do anything related to the user interface: react to mouse clicks, play sounds, etc.
In Node.js, the platform-specific API lets you read and write files, download data via HTTP, etc.
5.3.1. Browser consoles
Web browsers have so-called consoles: Interactive command lines to which you can print text via console.log() and where you can run pieces of code. How to open the console differs from browser to browser. Fig. 3 shows the console of Google Chrome.
To find out how to open the console in your web browser, you can do a web search for “console «name-of-your-browser»”. These are pages for a few commonly used web browsers:
REPL stands for read-eval-print loop and basically means command line. To use it, you must first start Node.js from an operating system command line, via the command node. Then an interaction with it looks as depicted in fig. 4: The text after > is input from the user; everything else is output from Node.js.
Reading: REPL interactions