Hands-on Node.js cover page
Hands-on Node.js

Hands-on Node.js


Hands-on Node.js Edit
This book is 100% Complete
  • $11.99

    Minimum

  • $11.99

    Suggested

Bundles

Hands-on Node.js
Rapid Prototyping with JS

Full-Stack JavaScript Mastery

  • $26.98

    Regular Price

  • $20.24

    Suggested

2 Books

Learn more
Sublime Productivity
Hands-on Node.js

Sublime Productivity + Hands-On Node.js

  • $36.99

    Regular Price

  • $35.00

    Suggested

2 Books

Learn more
Hands-on Node.js
The Node Beginner Book
The Node Craftsman Book

The Node.js Bundle

  • $40.99

    Regular Price

  • $30.00

    Suggested

3 Books

Learn more

About the Book

In this e-book we will analyze what makes Node a different proposal from all that is out there, why you should use it, and how to get started. It starts with an overview but quickly dives into the code, module by module. By the end of this book you should be able to build your own Node service producers and consumers, and also feel comfortable around the Node API and conventions.

By the end of it you should be able to build your own Node modules, as well as test and debug them.

Read More

Table of Contents

  • Introduction
    • Why the sudden, exponential popularity?
    • What does this book cover?
    • What does this book not cover?
    • Prerequisites
    • Exercises
    • Source code
    • Where will this book lead you?
  • Why?
    • Why the event loop?
      • Solution 1: Create more call stacks
      • Solution 2: Use event-driven I/O
    • Why JavaScript?
      • How I Learned to Stop Fearing and Love JavaScript
        • Function Declaration Styles
        • Functions are first-class objects
      • JSHint
      • JavaScript versions
    • References
  • Starting up
    • Install Node
  • Understanding
    • Understanding the Node event loop
      • An event-queue processing loop
      • Callbacks that will generate events
      • Don’t block!
  • Modules and NPM
    • Modules
      • How Node resolves a module path
        • Core modules
        • Modules with complete or relative path
        • As a file
        • As a directory
        • As an installed module
    • NPM - Node Package Manager
      • Global vs. Local
      • NPM commands
        • npm ls [filter]
        • npm install package[@filters]
        • npm rm package_name[@version] [package_name[@version] …]
        • npm view [@] [[.]…]
    • The Package.json Manifest
  • Utilities
    • console
    • util
  • Buffers
    • Slice a buffer
    • Copy a buffer
    • Buffer Exercises
      • Exercise 1
      • Exercise 2
      • Exercise 3
  • Event Emitter
    • Creating an Event Emitter
    • Event Emitter Exercises
      • Exercise 1
      • Exercise 2
  • Timers
    • setTimeout
    • clearTimeout
    • setInterval
    • clearInterval
    • setImmediate
      • Escaping the event loop
      • A note on tail recursion
  • Low-level file-system
    • fs.stat and fs.fstat
    • Open a file
    • Read from a file
    • Write into a file
      • Close Your files
    • File-system Exercises
      • Exercise 1 - get the size of a file
      • Exercise 2 - read a chunk from a file
      • Exercise 3 - read two chunks from a file
      • Exercise 4 - Overwrite a file
      • Exercise 5 - append to a file
      • Exercise 6 - change the content of a file
  • HTTP
    • HTTP Server
      • The http.ServerRequest object
        • req.url
        • req.method
        • req.headers
        • The http.ServerResponse object
          • Write a header
          • Change or set a header
          • Remove a header
          • Write a piece of the response body
    • HTTP Client
        • http.get()
      • http.request()
    • HTTP Exercises
      • Exercise 1
      • Exercise 2
      • Exercise 3
      • Exercise 4
  • Streams
    • ReadStream
      • Wait for data
      • Know when it ends
      • Pause it
      • Resume it
    • WriteStream
      • Write to it
      • Wait for it to drain
    • Some stream examples
      • Filesystem streams
      • Network streams
    • The Slow Client Problem and Back-pressure
      • What can we do?
      • Pipe
  • TCP
    • Write a string or a buffer
    • end
    • …and all the other methods
    • Idle sockets
    • Keep-alive
    • Delay or no delay
    • server.close()
    • Listening
    • TCP client
    • Error handling
    • TCP Exercises
      • Exercise 1
      • Exercise 2
  • Datagrams (UDP)
    • Datagram server
    • Datagram client
    • Datagram Multicast
      • Receiving multicast messages
      • Sending multicast messages
      • What can be the datagram maximum size?
    • UDP Exercises
      • Exercise 1
  • Child processes
    • Executing commands
    • Spawning processes
    • Killing processes
    • Child Processes Exercises
      • Exercise 1
  • Streaming HTTP chunked responses
      • A streaming example
    • Streaming Exercises
      • Exercise 1
  • TLS / SSL
    • Public / private keys
      • Private key
      • Public key
    • TLS Client
    • TLS Server
      • Verification
    • TLS Exercises
      • Exercise 1
      • Exercise 2
      • Exercise 3
      • Exercise 4
      • Exercise 5
  • HTTPS
    • HTTPS Server
    • HTTPS Client
  • Making modules
    • CommonJS modules
    • One file module
    • An aggregating module
    • A pseudo-class
    • A pseudo-class that inherits
    • node_modules and npm bundle
      • Bundling
  • Debugging
    • console.log
    • Node built-in debugger
    • Node Inspector
    • Live edit
  • Automated Unit Testing
    • A test runner
    • Assertion testing module
      • should.js
          • Assert truthfulness:
          • or untruthfulness:
          • = true
          • = false
          • emptiness
          • equality
          • equal (strict equality)
          • assert numeric range (inclusive) with within
          • test numeric value is above given value:
          • test numeric value is below given value:
          • matching regular expressions
          • test length
          • substring inclusion
          • assert typeof
          • property existence
          • array containment
          • own object keys
          • responds to, asserting that a given property is a function:
    • Putting it all together
  • Callback flow
    • The boomerang effect
    • Using caolan/async
      • Collections
        • Parallel Iterations
        • async.forEach
        • async.map
        • async.forEachLimit
        • async.filter
        • async.reject
        • async.reduce
        • async.detect
        • async.some
        • async.every
      • Flow Control
        • async.series
        • async.parallel
        • async.whilst
        • async.until
        • async.waterfall
        • async.queue
  • Appendix - Exercise Results
    • Chapter: Buffers
      • Exercise 1
        • One Solution:
      • Exercise 2
        • One Solution:
      • Exercise 3
        • One Solution:
    • Chapter: Event Emitter
      • Exercise 1
        • One Solution:
      • Exercise 2
        • One Solution:
    • Chapter: Low-level File System
      • Exercise 1 - get the size of a file
        • One Solution:
      • Exercise 2 - read a chunk from a file
        • One Solution:
      • Exercise 3 - read two chunks from a file
        • One Solution:
      • Exercise 4 - Overwrite a file
        • One Solution:
      • Exercise 5 - append to a file
        • One Solution:
      • Exercise 6 - change the content of a file
        • One Solution:
    • Chapter: HTTP
      • Exercise 1
        • One Solution:
      • Exercise 2
        • One Solution:
      • Exercise 3
        • One Solution:
      • Exercise 4
        • One Solution:
    • Chapter: Child processes
      • Exercise 1
        • One Solution:
    • Chapter: Streaming HTTP Chunked responses
      • Exercise 1
        • One Solution:
    • Chapter: UDP
      • Exercise 1
        • One Solution:
    • Chapter: TCP
      • Exercise 1
        • One Solution:
      • Exercise 2
        • One Solution:
    • Chapter: SSL / TLS
      • Exercise 1
        • One Solution:
      • Exercise 2
        • One Solution:
      • Exercise 3
        • One Solution:
      • Exercise 4
        • One Solution:
      • Exercise 5
        • One Solution:

Read More

About the Author

The Leanpub Unconditional, No Risk, 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks. We process the refunds manually, so they may take a few days to show up.
See full terms