Copyright
Brief Table of Contents
Table of Contents
Foreword
Preface
Acknowledgments
About this Book
About the Cover Illustration
1. Node fundamentals
Chapter 1. Welcome to Node.js
1.1. Built on JavaScript
1.2. Asynchronous and evented: the browser
1.3. Asynchronous and evented: the server
1.4. DIRTy applications
1.5. DIRTy by default
1.5.1. Simple async example
1.5.2. Hello World HTTP server
1.5.3. Streaming data
1.6. Summary
Chapter 2. Building a multiroom chat application
2.1. Application overview
2.2. Application requirements and initial setup
2.2.1. Serving HTTP and WebSocket
2.2.2. Creating the application file structure
2.2.3. Specifying dependencies
2.2.4. Installing dependencies
2.3. Serving the application���s HTML, CSS, and client-side JavaScript
2.3.1. Creating a basic static file server
2.3.2. Adding the HTML and CSS files
2.4. Handling chat-related messaging using Socket.IO
2.4.1. Setting up the Socket.IO server
2.4.2. Handling application scenarios and events
2.5. Using client-side JavaScript for the application���s user interface
2.5.1. Relaying messages and name/room changes to the server
2.5.2. Showing messages and available rooms in the user interface
2.6. Summary
Chapter 3. Node programming fundamentals
3.1. Organizing and reusing Node functionality
3.1.1. Creating modules
3.1.2. Fine-tuning module creation using module.exports
3.1.3. Reusing modules using the node_modules folder
3.1.4. Caveats
3.2. Asynchronous programming techniques
3.2.1. Handling one-off events with callbacks