15 Introduction to Node.js

Node.js is an open-source project that lets you write JavaScript that runs outside the browser.

When you write JavaScript for the browser, your code is given access to global objects like the document and window, as well as other APIs and libraries. With Node, your code can access the hard drive, databases, and the network (Figure 15.1).

Figure 15.1  JavaScript running in browser vs via Node

JavaScript running in browser vs via Node

Using Node, you can create anything from command-line tools to web servers. Over the next four chapters, you will use Node to help create a real-time chat application called Chattrbox (Figure 15.2).

Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.