Free Sample
+ Collection

Node Cookbook: Second Edition

David Mark Clements

Transferring your JavaScript skills to server-side programming is simplified with this comprehensive cookbook. Each chapter focuses on a different aspect of Node, featuring recipes supported with lots of illustrations, tips, and hints.
RRP $29.99
RRP $49.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781783280438
Paperback378 pages

About This Book

  • Work with JSON, XML, web sockets to make the most of asynchronous programming
  • Extensive code samples covering Express 4 and Socket.IO
  • Learn how to process data with streams and create specialized streams
  • Packed with practical recipes taking you from the basics to extending Node with your own modules

Who This Book Is For

If you have some knowledge of JavaScript and want to build fast, efficient, scalable client-server solutions, then Node Cookbook Second Edition is for you. Knowledge of Node will be an advantage but is not required. Experienced users of Node will be able to improve their skills.

Table of Contents

Chapter 1: Making a Web Server
Setting up a router
Serving static files
Caching content in memory for immediate delivery
Optimizing performance with streaming
Securing against filesystem hacking exploits
Chapter 2: Exploring the HTTP Object
Processing POST data
Handling file uploads
Using Node as an HTTP client
Implementing download throttling
Chapter 3: Working with Data Serialization
Converting an object to JSON and back
Converting an object to XML and back
Browser-server transmission via AJAX
Working with real data – fetching trending tweets
Chapter 4: Interfacing with Databases
Writing to a CSV file
Connecting and sending SQL to a MySQL server
Storing and retrieving data with MongoDB
Storing data to CouchDB with Cradle
Retrieving data from CouchDB with Cradle
Accessing the CouchDB changes stream with Cradle
Storing and retrieving data with Redis
Implementing PubSub with Redis
Chapter 5: Employing Streams
Consuming streams
Playing with pipes
Making stream interfaces
Streaming across Node processes
Chapter 6: Going Real Time
Creating a WebSocket server
Cross-browser real-time logic with Socket.IO
Remote Procedure Calls with Socket.IO
Creating a real-time widget
Chapter 7: Accelerating Development with Express
Generating Express scaffolding
Managing server tier environments
Implementing dynamic routing
Templating in Express
CSS preprocessors with Express
Initializing and using a session
Making an Express web app
Chapter 8: Implementing Security, Encryption, and Authentication
Implementing Basic Authentication
Hashing passwords
Implementing Digest Authentication
Setting up an HTTPS web server
Preventing cross-site request forgery
Chapter 9: Integrating Network Paradigms
Sending an e-mail
Sending an SMS
Communicating with TCP
Creating an SMTP server
Implementing a virtual hosting paradigm
Chapter 10: Writing Your Own Node Modules
Creating a test-driven module specification
Writing a functional module mock-up
Refactoring with prototypical inheritance
Extending a module's API
Deploying a module to npm
Chapter 11: Taking It Live
Deploying an app to a server environment
Automatic crash recovery
Continuous deployment
Hosting with a Platform as a Service provider

What You Will Learn

  • Create different kinds of servers
  • Manipulate all kinds of data
  • Interface with various databases
  • Use streams for efficient, powerful data shuffling
  • Create real-time apps
  • Create command-line apps
  • Write and publish your own modules
  • Work with the Express framework
  • Get to grips with the module ecosystem
  • Explore with external remote APIs
  • Learn various security, encryption, and authentication techniques

In Detail

Node Cookbook Second Edition shows you how to transfer your JavaScript skills to server-side programming. It will talk you through the various server-side scenarios, often saving you time and effort by demonstrating best practices and showing you how to avoid security faux pas.

Beginning with making your own web server, the recipes are designed to allow smooth progression through Node in order to help you design full web applications, command-line applications, and Node modules.

There's also extensive coverage on using popular frameworks such as Express 4 and Socket.IO, writing your own Node modules and different ways to take your apps live.


Read More