Learning Node: Moving to the Server-Side

Learning Node: Moving to the Server-Side

by Shelley Powers
Learning Node: Moving to the Server-Side

Learning Node: Moving to the Server-Side

by Shelley Powers

eBook

$25.49  $33.99 Save 25% Current price is $25.49, Original price is $33.99. You Save 25%.

Available on Compatible NOOK Devices and the free NOOK Apps.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

Take your web development skills from browser to server with Node—and learn how to write fast, highly scalable network applications on this JavaScript-based platform. Updated for the latest Node Long Term Support (LTS) and Node Current (6.0) releases, this hands-on edition helps you master Node’s core fundamentals and gain experience with several built-in and contributed modules.

Get up to speed on Node’s event-driven, asynchronous I/O model for developing data-intensive applications that are frequently accessed but computationally simple. If you’re comfortable working with JavaScript, this book provides many programming and deployment examples to help you take advantage of server-side development with Node.

  • Explore the frameworks and functionality for full-stack Node development
  • Dive into Node’s module system and package management support
  • Test your application or module code on the fly with Node’s REPL console
  • Use core Node modules to build web applications and an HTTP server
  • Learn Node’s support for networks, security, and sockets
  • Access operating system functionality with child processes
  • Learn tools and techniques for Node development and production
  • Use Node in microcontrollers, microcomputers, and the Internet of Things

Product Details

ISBN-13: 9781491943076
Publisher: O'Reilly Media, Incorporated
Publication date: 05/24/2016
Sold by: Barnes & Noble
Format: eBook
Pages: 288
File size: 12 MB
Note: This product may take a few minutes to download.

About the Author

Shelley Powers has been working with, and writing about, web technologies--from the first release of JavaScript to the latest graphics and design tools--for more than 12 years. Her recent O'Reilly books have covered the semantic web, Ajax, JavaScript, and web graphics. She's an avid amateur photographer and web development aficionado, who enjoys applying her latest experiments on her many web sites.

Table of Contents

Preface vii

1 The Node Environment 1

Installing Node 2

Saying Hello to the World with Node 3

A Basic Hello World Application 3

Hello World, Tweaked 6

Node Command-Line Options 10

Node Hosting Environments 11

Hosting Node on Your Server, VPS, or Managed Host 11

Cloud Hosting 11

The Node LTS and Upgrading Node 13

Node's New Semantic Versioning 13

Upgrading Node 14

Node, V8, and ES6 16

Advanced: Node C/C++ Add-ons 17

2 Node Building Blocks: Global Objects, Events, and Node's Asynchronous Nature 19

The global and process Objects 20

The global Object 20

The process Object 21

Buffers, Typed Arrays, and Strings 25

Buffer, JSON, StringDecoder, and UTF-8 Strings 28

Buffer Manipulation 30

Node's Callback and Asynchronous Event Handling 33

The Event Queue (Loop) 33

Creating an Asynchronous Callback Function 36

EventEmitter 39

The Node Event Loop and Timers 43

Nested Callbacks and Exception Handling 46

3 Basics of Node Modules and Node Package Manager (npm) 55

An Overview of the Node Module System 55

How Node Finds and Loads a Module 56

Sandboxing and the VM Module 59

An In-Depth Exploration of NPM 63

Creating and Publishing Your Own Node Module 69

Creating a Module 69

Packaging an Entire Directory 70

Preparing Your Module for Publication 71

Publishing the Module 75

Discovering Node Modules and Three Must-Have Modules 76

Better Callback Management with Async 77

Command-Line Magic with Commander 83

The Ubiquitous Underscore 84

4 Interactive Node with REPL and More on the Console 87

REPL: First Looks and Undefined Expressions 87

Benefits of REPL: Getting a Closer Understanding of JavaScript Under the Hood 89

Multiline and More Complex JavaScript 90

REPL Commands 94

REPL and rlwrap 95

Custom REPL 96

Stuff Happens-Save Often 100

The Necessity of the Console 100

Console Message Types, Console Class, and Blocking 100

Formatting the Message, with Help from util.format() and util.inspect() 103

Providing Richer Feedback with console and a Timer 107

5 Node and the Web 109

The HTTP Module: Server and Client 109

What's Involved in Creating a Static Web Server 114

Using Apache to Proxy a Node Application 124

Parsing the Query with Query String 125

DNS Resolution 126

6 Node and the Local System 129

Exploring the Operating System 129

Streams and Pipes 131

A Formal Introduction to the File System 133

The fs.Stats Class 134

The File System Watcher 135

File Read and Write 136

Directory Access and Maintenance 138

File Streams 138

Resource Access with Path 141

Creating a Command-Line Utility 142

Compression/Decompression with ZLib 144

Pipes and ReadLine 148

7 Networking, Sockets, and Security 151

Servers, Streams, and Sockets 151

Sockets and Streams 151

TCP Sockets and Servers 152

UDP/Datagram Socket 157

Guards at the Gate 159

Setting Up TLS/SSL 159

Working with HTTPS 161

The Crypto Module 163

8 Child Processes 169

Child_process.spawn 169

Child_process.exec and child_process.execFile 173

Child_process.fork 175

Running a Child Process Application in Windows 177

9 Node and ES6 179

Strict Mode 179

Let and const 181

Arrow Functions 183

Classes 185

Promises with Bluebird 187

10 Full-Stack Node Development 191

The Express Application Framework 192

MongoDB and Redis Database Systems 198

MongoDB 199

Redis Key/Value Store 202

AngularJS and Other Full-Stack Frameworks 210

11 Node in Development and Production 217

Debugging Node Applications 217

The Node Debugger 217

Node Inspector 222

Unit Testing 226

Unit Testing with Assert 226

Unit Testing with Nodeunit 229

Other Testing Frameworks 231

Keeping Node Up and Running 234

Benchmark and Load Testing with Apache Bench 237

12 Node in New Environments 241

Samsung IoT and GPIO 241

Windows with Chakra Node 243

Node for Microcontrollers and Microcomputers 245

Fritzing 246

Node and Adruino 252

Node and Raspberry Pi 2 259

Index 263

From the B&N Reads Blog

Customer Reviews