Appendix E. Setting up Node.js

 

This appendix is provided for readers who need to set up Node.js for the chapter 4 application. You might be wondering why we chose Node.js. There are several alternative web servers that are much better suited to WebSockets than the traditional choices of Apache or IIS (IIS8 will have built-in WebSocket support). These servers share connections between threads, taking advantage of the mostly idle nature of event-driven connections. In chapter 4, you’ll be using Node.js for two reasons:

  • It uses JavaScript, which you’re already familiar with.
  • It has an easy-to-use library implementing the WebSocket protocol.

This appendix will walk you through installing and setting up Node.js for the chapter 4 application. You’ll also learn how to build basic web applications with Node.js and how to use the Node Package Manager (NPM). NPM lets you easily install modules to extend the functionality of Node. You’ll also create a simple application to confirm that the modules are installed correctly.

E.1. Setting up Node.js to serve web content

E.2. Easy web apps with Node modules