PacktLib: Mastering Node.js

Mastering Node.js

Credits

About the Author

Acknowledgments

About the Reviewers

www.PacktPub.com

Preface

Understanding the Node Environment

Extending JavaScript

V8

The process object

The Read-Eval-Print Loop and executing a Node program

Summary

Understanding Asynchronous Event-Driven Programming

Broadcasting events

Listening for events

Timers

Understanding the event loop

Callbacks and errors

Listening for file changes

Summary

Streaming Data Across Nodes and Clients

Exploring streams

Creating an HTTP server

HTTPS, TLS (SSL), and securing your server

The request object

Working with headers

Handling POST data

Creating and streaming images with Node

Summary

Using Node to Access the Filesystem

Directories, and iterating over files and folders

Reading from a file

Writing to a file

Serving static files

Handling file uploads

Summary

Managing Many Simultaneous Client Connections

Understanding concurrency

Routing requests

Using Redis for tracking client state

Handling sessions

Authenticating connections

Summary

Further reading

Creating Real-time Applications

Introducing AJAX

Bidirectional communication with Socket.IO

Listening for Server Sent Events

Building a collaborative document editing application

Summary

Utilizing Multiple Processes

Node's single-threaded model

Creating child processes

Communicating with your child

Parsing a file using multiple processes

Real-time activity updates of multiple worker results

Summary

Scaling Your Application

When to scale?

Running multiple Node servers

Message queues – RabbitMQ

Using Node's UDP module

Using Amazon Web Services in your application

Authenticating with Facebook Connect

Summary

Testing your Application

Why testing is important

Native Node testing and debugging tools

Headless website testing with ZombieJS and Mocha

Using Grunt, Mocha, and PhantomJS to test and deploy projects

Summary

Organizing Your Work

Organizing Your Work

Organizing Your Work

Introducing the Path Framework

Introducing the Path Framework

Introducing the Path Framework

Introducing the Path Framework

Introducing the Path Framework

Creating your own C++ Add-ons

Creating your own C++ Add-ons

Creating your own C++ Add-ons

Creating your own C++ Add-ons

Creating your own C++ Add-ons

Creating your own C++ Add-ons

Index