Course Overview
This 3-day Introduction to Node.js teaches the fundamental concepts involved in writing server-side applications using Node.js. Attendees will learn about Node.js best practices and conventions while working with popular libraries, frameworks, and back-end services to write a variety of different applications.
Key Learning Areas
- ES6+ syntax
- Understanding callbacks and asynchronous code
- Finding and installing modules with NPM
- Creating, using, and publishing modules
- Listening for and handling events
- Working with streams
- Promises
- RESTful APIs
- Express
- MongoDB
Course Outline
Introduction
- What is Node.js?
- What is it good for?
- What is it not good for?
- History of Node.js
- Who Uses Node?
- How Does Node.js Work?
- Node's REPL
- Your First Node Program
- Lab: Intro to Node
- What is Node.js Made Of?
- How is Node.js Different?
- Lab: First Look at Async Code
Node Modules
- Modules Overview
- CommonJS Example
- Using Modules
- Modules vs. Packages
- Sources of Modules
- npm
- node_modules
- json
- Npm Install
- Examples of packages from npm
- Lab: Intro to npm
- Node's Core Modules
- The http Module
- The http Module (cont)
- Lab: A Simple Node.js Server
- The fs module
- Buffer Objects
- Modularizing Your Code
- Returning Values from Modules
- Using a Local Module
- Lab: Creating Modules
- ES6 Modules
Events and Streams
- Non-blocking with Events
- Events
- EventEmitter
- Code Walkthrough: Extending EventEmitter
- Code Walkthrough: Emit events from a function
- Node Stream Objects
- Types of Streams
- Using Readable Streams
- Using Writable Streams
- Duplex and Transform Streams
- Lab: Working with Streams
- The Pipe Method
- Lab: Piping Between Streams
The Process Object
- Command Line Arguments
- Lab: The process object
Understanding Callbacks
- Using Callbacks
- Node's Error Convention
Promises
- What Are Promises?
- Promises vs. Event Listeners
- Why Use Promises?
- Demo: Callback vs. Promise
- Using Promises
- Promises with Bluebird
- async/await
- Upgrading to async/await
- Lab: Promises
Node on the Web
- How the Web Works
- HTTP
- HTTP Methods
- Making an HTTP Request
- Lab: Getting Data with HTTP
- RESTful Web Services
- RESTful Web Services in Practice
Testing and Debugging
- Test Driven Development
- The TDD Cycle
- TDD Steps
- Assertions
- JavaScript Testing Frameworks
- JS Exception Handling
- TDD vs. BDD
- The assert module
- Using assert
- Lab: Testing with assert
- Mocha and should.js
- Testing with Mocha and should.js
- Running Tests with Mocha
Using Express
- What is Express?
- Getting Started with Express
- Express Hello World Server
- Routing with Express
- Serve Static Content with Express
- Lab: Make an Express Server
Database Access with Node.js
- mongod and mongo
- Use MongoDB in Node
- Insert Data
- Test it out
- Retrieve from MongoDB
- Lab: hapi 16
- Lab: Async Await and hapi 17
JavaScript Review / Reference
- JavaScript is NOT Java
- Is JavaScript "Real" Programming?
- Where Can You Use JavaScript?
- How JavaScript Works
- Is JavaScript Slow?
- JavaScript Engines
- JavaScript Syntax
- JavaScript Data Types
- JavaScript Primitives
- Variables and Arrays
- Creating and Using Variables
- Variable Scoping with const and let
- let vs. var
- Creating and Using Arrays
- JavaScript Operators
- Template Literals
- Functions
- Global Functions
- Custom Functions
- Arrow Functions
- Arrow Function Parameters
- Arrow Functions (cont.)
- JavaScript Objects
- Built-in Objects
- Creating Objects
- Using Objects
- Prototypal Inheritance
Who Benefits
This course is for professional JavaScript programmers and back-end web developers.
Prerequisites
Attendees should have at least a beginning to intermediate level of knowledge with JavaScript. Specifically, they should be comfortable working with JavaScript functions and objects.
The courseware includes slides, notes, assignments, a pre/post assessment test, and complete source code for all assignments.