1. Trang chủ
  2. » Công Nghệ Thông Tin

PROFESSIONAL NODE.JS® pptx

412 630 3

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Professional Node.js®: Building Javascript-Based Scalable Software

  • Copyright

  • About the Author

  • About the Technical Editor

  • Credits

  • Acknowledgments

  • Contents

  • Introduction

    • Who This Book Is for

    • What This Book Covers

    • How This Book Is Structured

    • What You Need to Use This Book

    • Conventions

    • Source Code

    • Errata

    • P2P.Wrox.Com

  • Part I: Introduction and Setup

    • Chapter 1: Installing Node

      • Installing Node on Windows

      • Installing on Mac OS X

      • Installing Node Using the Source Code

        • Choosing the Node Version

        • Downloading the Node Source Code

        • Building Node

        • Installing Node

        • Running Node

      • Setting Up and Using Node Package Manager

        • Using NPM to Install, Update, and Uninstall Packages

      • Summary

    • Chapter 2: Introducing Node

      • Introducing the Event-Driven Programming Style

      • How Node and JavaScript Make Writing Asynchronous Applications Easier

        • What Are Closures?

        • How Closures Help When Programming Asynchronously

      • Summary

  • Part II: Node Core API Basics

    • Chapter 3: Loading Modules

      • Understanding How Node Loads Modules

      • Exporting a Module

        • Loading a Module

      • Summary

    • Chapter 4: Using Buffers to Manipulate, Encode, and Decode Binary Data

      • Creating a Buffer

      • Getting and Setting Bytes in a Buffer

      • Slicing a Buffer

      • Copying a Buffer

      • Decoding a Buffer

      • Summary

    • Chapter 5: Using the Event Emitter Pattern to Simplify Event Binding

      • Understanding the Standard Callback Pattern

      • Understanding the Event Emitter Pattern

      • Understanding Event Types

      • Using the Event Emitter API

        • Binding Callbacks Using .addListener() or .on()

        • Binding Multiple Event Listeners

        • Removing an Event Listener from an Event Emitter Using .removeListener()

        • Getting a Callback Executed at Most Once Using .once()

        • Removing All Event Listeners from an Event Emitter Using .removeAllListeners()

      • Creating an Event Emitter

        • Inheriting from Node Event Emitter

        • Emitting Events

      • Summary

    • Chapter 6: Scheduling the Execution of Functions Using Timers

      • Using setTimeout to Defer the Execution of a Function

      • Using clearTimeout to Cancel the Execution of a Function

      • Scheduling and Canceling the Repetitive Execution of a Function

      • Using process.nextTick to Defer the Execution of a Function Until the Next Event Loop Iteration

      • Blocking the Event Loop

      • Escaping the Event Loop

      • Using setTimeout Instead of setInterval to Force Serialization

      • Summary

  • Part III: Files, Processes, Streams, and Networking

    • Chapter 7: Querying, Reading from, and Writing to Files

      • Manipulating File Paths

        • Normalizing Paths

        • Joining Paths

        • Resolving Paths

        • Finding the Relative Path Between Two Absolute Paths

        • Extracting Components of a Path

        • Determining the Existence of a Path

      • Introducing the fs Module

        • Querying File Statistics

      • Opening a File

      • Reading from a File

        • Writing to a File

        • Closing a File

      • Summary

    • Chapter 8: Creating and Controlling External Processes

      • Executing External Commands

      • Spawning Child Processes

        • Creating the Child Process

        • Listening for Data from the Child Process

        • Sending Data to the Child Process

        • Receiving Notification When the Child Process Exits

      • Signaling and Killing Processes

      • Summary

    • Chapter 9: Reading and Writing Streams of Data

      • Using a Readable Stream

        • Waiting for Data

        • Pausing and Resuming a Stream

        • Knowing When the Stream Ends

      • Using Writable Streams

        • Writing Data into a Stream

        • Waiting for a Stream to Drain

      • Considering Some Stream Examples

        • Creating File-System Streams

        • Understanding Networking Streams

      • Avoiding the Slow Client Problem and Saving Your Server

        • Understanding the Slow Client Problem

        • Avoiding the Slow Client Problem

        • Using stream.pipe() to Prevent the Slow Client Problem and Assembling Readable and Writable Streams Using pipe()

      • Summary

    • Chapter 10: Building TCP Servers

      • Creating a TCP Server

        • Using the Socket Object

        • Understanding Idle Sockets

        • Setting Up Keep-Alive

        • Using Delay or No Delay

        • Listening for Client Connections

        • Closing the Server

        • Handling Errors

      • Building a Simple TCP Chat Server

        • Accepting Connections

        • Reading Data from a Connection

        • Collecting All the Clients

        • Broadcasting Data

        • Removing Closed Connections

        • Using Your TCP Chat Server

      • Summary

    • Chapter 11: Building HTTP Servers

      • Understanding the http.ServerRequest Object

      • Understanding the http.ServerResponse Object

        • Writing a Header

        • Changing or Setting a Header

        • Removing a Header

        • Writing a Piece of the Response Body

      • Streaming HTTP Chunked Responses

        • Piping a File

        • Piping the Output of Another Process

      • Shutting Down the Server

      • Example 1: Building a Server that Serves Static Files

      • Example 2: Making Use of HTTP Chunked Responses and Timers

      • Summary

    • Chapter 12: Building a TCP Client

      • Connecting to a Server

      • Sending and Receiving Data

      • Ending the Connection

      • Handling Errors

      • Building an Example Command-Line TCP Client

        • Connecting to the Server

        • Sending the Command Line to the Server

        • Printing Server Messages

        • Reconnecting if the Connection Dies

        • Closing the Connection

        • Putting the Client Together

      • Summary

    • Chapter 13: Making HTTP Requests

      • Making GET Requests

      • Using Other HTTP Verbs

        • Inspecting the Response Object

        • Obtaining the Response Body

        • Streaming the Response Body

      • Pooling Sockets Using http.Agent

      • Using a Third-Party Request Module to Simplify HTTP Requests

        • Installing and Using Request

        • Creating a Testing Server

        • Following Redirects

        • Setting Some Request Options

        • Encoding the Request Body

        • Streaming

        • Using a Cookie Jar

      • Summary

    • Chapter 14: Using Datagrams (UDP)

      • Understanding UDP

      • Understanding the Uses of UDP

      • Building a Datagram Server

        • Listening for Messages

        • Testing the Server

        • Inspecting Additional Message Information

      • Creating a Simple Datagram Echo Server

        • Waiting for Messages

        • Sending Messages Back to Senders

        • Putting the Echo Server Together

      • Building a Datagram Client

        • Creating the Client

        • Sending Messages

        • Closing the Socket

      • Creating a Simple Datagram Command-Line Client

        • Reading from the Command Line

        • Sending Data to the Server

        • Receiving Data from the Server

        • Putting the Command-Line UDP Client Together

      • Understanding and Using Datagram Multicast

        • Receiving Multicast Messages

        • Sending Multicast Messages

        • Understanding Maximum Datagram Size

      • Summary

    • Chapter 15: Securing Your TCP Server with TLS/SSL

      • Understanding Private and Public Keys

        • Generating a Private Key

        • Generating a Public Key

      • Building a TLS Server

        • Initializing the Server

        • Listening for Connections

        • Reading Data from the Client

        • Sending Data to the Client

        • Ending the Connection

      • Building a TLS Client

        • Initializing the Client

        • Connecting to the Server

        • Verifying the Server Certificate

        • Sending Data to the Server

        • Reading Data from the Server

        • Ending the Connection

      • Building Some Examples

        • Creating a TLS Chat Server

        • Creating a TLS Command-Line Chat Client

        • Verifying the Client Certificate

      • Summary

    • Chapter 16: Securing Your HTTP Server with HTTPS

      • Building a Secure HTTP Server

        • Setting Up the Server Options

        • Listening for Connections

        • Validating the HTTPS Client Certificate

      • Creating an HTTPS Client

        • Initializing the Client

        • Making the Request

        • Validating the HTTPS Server Certificate

      • Summary

  • Part IV: Building and Debugging Modules and Applications

    • Chapter 17: Testing Modules and Applications

      • Using a Test Runner

        • Writing Tests

        • Running Tests

      • Using an Assertion Testing Module

        • Using the assert Module

        • Using the Built-in Assertion Functions in Node-Tap

      • Testing Your Asynchronous Module

      • Summary

    • Chapter 18: Debugging Modules and Applications

      • Using console.log

      • Using Node's Built-in Debugger

      • Using Node Inspector

      • Summary

    • Chapter 19: Controlling the Callback Flow

      • Understanding the Boomerang Effect

      • Avoiding the Boomerang Effect by Declaring Functions

      • Using the async Flow Control Library

        • Executing in Series

        • Executing in Parallel

        • Cascading

        • Queuing

        • Iterating

        • Mapping

        • Reducing

        • Filtering

        • Detecting

      • Summary

  • Part V: Building Web Applications

    • Chapter 20: Building and Using HTTP Middleware

      • Understanding the Connect HTTP Middleware Framework

      • Building Your Own HTTP Middleware

        • Creating Asynchronous Middleware

        • Registering Callbacks Inside Middleware

        • Handling Errors Inside Middleware

      • Using the HTTP Middleware Bundled in Connect

        • Logging Requests

        • Handling Errors

        • Serving Static Files

        • Parsing the Query String

        • Parsing the Request Body

        • Parsing Cookies

        • Using a Session

        • Other Available Middleware

      • Summary

    • Chapter 21: Making a Web Application Using Express.js

      • Initializing Your Express.js Application

      • Setting Up Middleware in Your Application

      • Routing Requests

        • Handling Routes

        • Using Sessions

        • Using Route Middleware

      • Summary

    • Chapter 22: Making Universal Real-Time Web Applications Using Socket.IO

      • Understanding How WebSockets Work

      • Using Socket.IO to Build WebSocket Applications

        • Installing and Running Socket.IO on the Server

        • Building a Real-Time Web Chat with Socket.IO

        • Extending the Chat Application

        • Detecting Disconnections

        • Separating Users into Rooms

        • Using Namespaces

        • Distributing the Server-Side Application Using Redis

      • Summary

  • Part VI: Connecting to Databases

    • Chapter 23: Connecting to MySQL Using node-mysql

      • Using a Library to Connect to and Communicate with a MySQL Database

      • Adding Data to the Database with Security Concerns in Mind

      • Reading Data Efficiently

      • Summary

    • Chapter 24: Connecting to CouchDB Using Nano

      • Installing Nano

      • Connecting and Creating a Database

      • Storing Documents

      • Creating and Using CouchDB Views

      • Attaching Files to a CouchDB Document

      • Summary

    • Chapter 25: Connecting to MongoDB Using Mongoose

      • Installing Mongoose

      • Understanding How Mongoose Uses Models to Encapsulate Database Access

      • Connecting to MongoDB

      • Defining a Schema

      • Defining a Model

        • Using Validators

        • Using Modifiers

        • Using Getters

        • Using Virtual Attributes

        • Using Default Values

        • Defining Indexes

        • Referencing Other Documents Using DB Refs

        • Defining Instance Methods

        • Defining Static Methods

      • Summary

  • Index

  • Advertisement

Nội dung

[...]... stop He taught himself how to program his father’s Apple IIc and then entered the PC era In college he was introduced to the universe of UNIX and open-source, becoming seriously addicted to it In his professional life he has developed systems and products built with Visual Basic, C, C++, Java, PHP, Ruby, and JavaScript for big telecommunications companies, banks, hotel chains, and others He has been... book All the source code used in this book is available for download at www.wrox.com Specifically for this book, the code download is on the Download Code tab at: http://www.wrox.com/WileyCDA/WroxTitle /Professional- Node-jsBuilding-Javascript-Based-Scalable-Software.productCd-1118185463.html You can also search for the book at www.wrox.com by ISBN to find the code And a complete list of code downloads... reader hours of frustration, and at the same time, you will be helping us provide even higher quality information To fi nd the errata page for this book, go to http://www.wrox.com/WileyCDA/WroxTitle/ Professional- Node-js-Building-Javascript-Based-Scalable-Software productCd-1118185463.html and click the Errata link On this page you can view all errata that has been submitted for this book and posted . INSTALLING NODE 3 Installing Node on Windows 4 Installing on Mac OS X 5 Installing Node Using the Source Code 6 Choosing the Node Version 6 Downloading the Node Source Code 6 Building Node 7 Installing. founding partner of The Node Firm and a Senior Programmer at Nodejitsu Inc., the leading Node. js platform-as-a-service provider. He is also the author of the popular Node Tuts screencasts. When. AM22/09/12 10:16 AM PROFESSIONAL Node. js ® ffirs.indd iiiffirs.indd iii 22/09/12 10:16 AM22/09/12 10:16 AM ffirs.indd ivffirs.indd iv 22/09/12 10:16 AM22/09/12 10:16 AM PROFESSIONAL Node. js ® BUILDING

Ngày đăng: 29/03/2014, 02:20

TỪ KHÓA LIÊN QUAN