Not a browser
Not a browserWelcome and Tech Check
We'll get set up and ensure everyone has the required software installed.
Not a browserProcess, Arguments, Input and Output
In Node.js, process is a global that provides information about your running Node program. Think of it as the server-side equivalent to a web browser’s
Many programming languages have a single “entry” point function (often called
Not a browserEXERCISE: Magic 8 Ball
Write a Node.js program that prompts the user for a question, and responds with a random answer. If the user provides something that doesn’t seem like a question, your program should use
process.stderrto tell the user their input is invalid, and allow them to try again.
Not a browserAsync Control Flow
While promises and
async/awaithave become the preferred way to manage asynchronous jobs, nearly all of the asynchronous functions in Node.js core libraries require a callback to be passed as an argument. We’ll compare different ways of managing concurrency, and hone in on today’s best practices.
Not a browserEXERCISE: Promisify
Modern versions of Node.js include a
promisifyutility function, which converts a node-callback-style function into a promise-emitting function. However, as a workshop instructor, I need to be able to support Node versions that don’t come with this! Write me a
promisify, and make sure that errors are handled properly.
Not a browserThe REPL and Debugging
The Node Read-Eval-Print-Loop (REPL) allows developers to execute statements in an interactive environment. We’ll learn how to make the REPL work for you, and a popular workflow involving prototyping code in isolation before bringing it into your program.
Not a browserEXERCISE: Bug Hunt
You’ll be given a program with a bug that slipped by all of our static code analysis. Set up a Visual Studio Code debugging configuration so that you can “launch” the program from within the editor. Use your knowledge of conditional breakpoints and restarting stack frames to track down the malfunction.
Not a browserLunch
Break for lunch