-
Notifications
You must be signed in to change notification settings - Fork 0
Lesson 01 Node Introduction
Lesson 1 just introduces Node.js, and has the student do simple standalone programs. The concept of modules and the require statement are introduced. The programs use the node.js globals and the os, path, fs (filesystem), and http modules. File IO is done using synchronous and asynchronous patterns. However the concept of promises and async/await is for Lesson 2, so the asynchronous file IO in lesson 1 just uses callbacks.
For each of the concepts, there are examples in the repository provided, but they do not exactly match the assignment. The prompter.js program is one they should customize to have some interesting behavior.
Pay particular attention to the part 7: the callback-based async fs module tutorial. Callbacks are consistently confusing for students. In mentor sessions, be prepared to explain them! Emphasize the low-level asynchrony that exists during I/O operations. It is important for students to learn that requesting the contents of a file from the OS and receiving a buffer into which the OS has loaded the file are two distinct events, and our programs work better when program execution is not blocked in the meantime.
This explainer from Hussein Nasser is a great place to point advanced students who want to know more.
Here is a more beginner-friendly explainer with lots of animations.