Book description
Node.js Recipes is your one-stop reference for learning how to solve Node.js problems. Node.js is the de facto framework for building JavaScript-powered servers. You will first be introduced to this exciting technology and what it can do, then learn through comprehensive and easy-to-follow recipes that use a problem-solution approach. Node.js Recipes teaches you to fully utilize the Node.js API, and leverage existing modules to build truly exciting projects.
Because Node.js is written in JavaScript on the server, it is accessible to those who not only relish in server-side programming but also web developers who understand the ubiquitous language of the web. Node.js Recipes covers all the essential ingredients required to become a seasoned Node.js developer in no time - become a Node.js pro today!
What you'll learn
Learn Node.js's beginnings and what problems it addresses
Build an understanding of Node.js's native capabilities
Create servers that communicate via TCP/IP, HTTP, and HTTPS
Understand and implement test-driven development practices
Successfully work with FileSystem, events, and child processes
Create a WebSocket server, use Socket.io, and frameworks such as ExpressJS and Yahoo! Mojito
Connect to a DataStore using Mongoose, MongoDB, MySQL and CouchDB
Implement security and cryptography using HMAC and TLS
Test synchronous and asynchronous code, and build a full test suite
Debug and deploy your application to Heroku, Nodejitsu and Windows Azure
Use Amazon Web Services to successfully host your Node.js application
Who this book is for
Node.js Recipes is for the reader who has some familiarity with JavaScript. They may have experience writing server-side JavaScript, but would like to get a more sound understanding of the capabilities that Node.js holds. This book will give them recipes enabling them to hone their JavaScript skills in a way that will harness Node.js and help them wrangle JavaScript on the server.
Table of contents
- Title Page
- Dedication
- Contents at a Glance
- Contents
- About the Author
- About the Technical Reviewers
- Acknowledgments
-
CHAPTER 1: Understanding Node.js
- 1-1. Installing Node.js on Your Machine
- 1-2. Installing the npm Package Manager
- 1-3. Understanding CommonJS Modules
- 1-4. Writing Modules for Your Application
- 1-5. Requiring Modules in Your Application
- 1-6. Using npm Modules
- 1-7. Getting Started with npm and Dependency
- 1-8. Installing a Node.js Version Manager
- 1-9. Using Multiple Versions of Node.js on Your Machine
- Summary
- CHAPTER 2: Networking with Node.js
-
CHAPTER 3: Using the File System
- 3-1. Retrieving Directory Structures
- 3-2. Navigating Through Directories
- 3-3. Manipulating the Directory Structure
- 3-4. Watching a Directory for Modifications
- 3-5. Reading Files
- 3-6. Writing Files
- 3-7. Moving Files
- 3-8. Symbolically Linking Files
- 3-9. Altering File Permissions
- 3-10. Watching Files for Modifications
-
CHAPTER 4: Building a Web Server
- 4-1. Setting Up an HTTP Server
- 4-2. Using SSL to Build an HTTPS Server
- 4-3. Processing Requests on Your Server
- 4-4. Sending Responses from Your Server
- 4-5. Handling Headers and Status Codes
- 4-6. Creating an HTTP Client
- 4-7. Processing Client Responses
- 4-8. Processing Client Requests
- 4-9. Responding to Events
- 4-10. Serving a Static Page via the File System
-
CHAPTER 5: Using Events and Child Processes
- 5-1. Creating a Custom Event
- 5-2. Adding a Listener for Custom Events
- 5-3. Implementing a One-time Event
- 5-4. Reducing Callbacks Using Events
- 5-5. Spawning a Child with .spawn
- 5-6. Running Shell Commands with .exec
- 5-7. Executing Shell Files with .execFile
- 5-8. Using .fork for Interprocess Communication
- Summary
-
CHAPTER 6: Implementing Security and Cryptography
- 6-1. Analyzing Types of Hash Algorithms
- 6-2. Hashing Data with createHash
- 6-3. Verifying File Integrity with Hashes
- 6-4. Using an HMAC to Verify and Authenticate Messages
- 6-5. Reviewing OpenSSL Ciphers and Security
- 6-6. Using OpenSSL Ciphers to Encrypt Data
- 6-7. Using Node.js’s TLS Module for Securing Your Server
- 6-8. Encrypting User Credentials with the Crypto Module
- 6-9. Using a Third-Party Authentication Module
- Summary
- CHAPTER 7: Discovering Other Node.js Modules
-
CHAPTER 8: Creating a WebSocket Server
- 8-1. Implementing a WebSocket Server with WebSocket-Node
- 8-2. Listening for WebSocket Events on the Client
- 8-3. Building a WebSocket API
- 8-4. Using Socket.IO for WebSocket Communications
- 8-5. Handling WebSocket Events in a Browser
- 8-6. Communicating Server Events via WebSockets
- 8-7. Two-way Communications with WebSockets
- 8-8. Building a Multiuser Whiteboard with WebSockets
-
CHAPTER 9: Using Web Server Frameworks
- 9-1. Getting Started with Express
- 9-2. Using Express to Generate an Application
- 9-3. Rendering HTML with Jade
- 9-4. Routing with Express
- 9-5. Handling Failed Requests in Your Application
- 9-6. Designing a RESTful API with ExpressJS
- 9-7. Up and Running with Geddy
- 9-8. Using Yahoo! Mojito
- 9-9. Building a Flatiron Application
- CHAPTER 10: Connecting to a Data Store
-
CHAPTER 11: Testing in Node.js
- 11-1. Choosing a Framework for Test-Driven Development or Behavior-Driven Development
- 11-2. Creating Tests with the Node.js assert Module
- 11-3. Creating Tests with Nodeunit
- 11-4. Creating Tests with Mocha
- 11-5. Creating Tests with Chai.js
- 11-6. Creating Tests with Vows
- 11-7. Creating Tests with Should.js
- 11-8. Reporting Code Coverage with Node-cover
- 11-9. Reporting Code Coverage with istanbul
- 11-10. Building a Full Test Suite
- 11-11. Implementing Testing into Your Workflow
- 11-12. Automating Your Testing
-
CHAPTER 12: Debugging and Deploying Your Application
- 12-1. Logging Information to the Console
- 12-2. Using a Graphical Debugging Tool
- 12-3. Debugging Your Application in a Production Environment
- 12-4. Continuously Running Your Server with Forever
- 12-5. Deploying Your Application on Your Own Server
- 12-6. Publishing Your Code to npm
- 12-7. Using Amazon Web Services to Host Your Application
- 12-8. Deploying Your Application Using Heroku
- 12-9. Deploying Your Application to Nodejitsu
- 12-10. Deploying to Windows Azure
- Index
Product information
- Title: Node.js Recipes: A Problem-Solution Approach
- Author(s):
- Release date: October 2013
- Publisher(s): Apress
- ISBN: 9781430260585
You might also like
book
Building APIs with Node.js
Learn how to build scalable APIs using the Node.js platform and ES6 (EcmaScript 2015) with this …
book
Node.js 8 the Right Way
Node.js is the platform of choice for creating modern web services. This fast-paced book gets you …
book
JavaScript Recipes: A Problem-Solution Approach
Quickly discover solutions to common problems, best practices you can follow, and everything JavaScript has to …
book
Pro Node.js for Developers
Since it's creation in 2009, Node.js has grown into a powerful and increasingly popular asynchronous-development framework …