Chapter 2. The basics of Node.js

This chapter covers

  • Installing Node.js and using its module system
  • Using package.json to describe your project’s metadata
  • Using npm to install packages with npm install
  • Doing two things at once with Node
  • Using Node’s built-in http module to build a simple web server

In chapter 1, we described Node.js, explaining that it’s JavaScript, asynchronous, and has a rich set of third-party modules. If you’re like me, you didn’t totally understand these things when you first started with Node. This chapter aims to give the intro to Node that I wish I had: short and sweet. (From here forward, I’ll refer to Node.js simply as Node.)

Note

I’m assuming that you know a fair bit of JavaScript and that you don’t want ...

Get Express in Action 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.