Core Node.js Training

Core Node.js Training

Objectives

On completion of this course, students will be able to:

  • Clearly understand the platform design choices that led to Node.js choosing an event loop and what this means for applications built on that foundation.
  • Understand the unique trade-offs present in event-driven programming.
  • Create Node.js modules and express code modularity in an application.
  • Understand the core flow control patterns in Node.js and know when it is appropriate to use callbacks, event emitters or streams.
  • Create and manipulate buffers efficiently.
  • Understand how to manage error state and know when a process should exit due to an error.
  • Build network applications with Node.js.

Prerequisites

Students taking this course should have JavaScript programming experience.

Syllabus

Intro to Node.jsRAM vs. I/O latency

  • Blocking vs. Non-Blocking
  • Event-driven Programming
  • JavaScript Closures
  • Event Loop
  • Blocking The Event Loop
  • Node.js Philosophy (userland vs. core)

Installing Node.jsDownload and Install

  • Node REPL
  • First Hello World
  • References (API docs, Mailing List, etc…)

Modules and npmAnatomy of a module

  • Private code
  • Accessing and using modules
  • npm commands
  • package.json

The Callback PatternWhat are callbacks

  • Examples
  • Callback-last
  • Error-first

Event Emitter

  • When to use Event Emitters
  • Binding Functions to Events
  • Examples
  • Creating an Event Emitter

Error Handling

  • Callbacks: Error-first
  • Errors in Event Emitters
  • Uncaught Exceptions
  • Using Domains

Buffers

  • Why Buffers exist
  • Creating Buffers
  • Reading Buffers
  • Writing Buffers
  • Manipulating Buffers

Streams

  • What are streams
  • Read Stream API
  • Write Stream API
  • Flow Control
  • Piping
  • Duplex Stream
  • Transform Stream