Now that you have been introduced to readline, it is time to use it to build a small application that collects answers to questions in the terminal. In this video, learn how to create a reusable asynchronous function that can be used to ask any number of questions in the terminal. Once all of the questions have been answered, learn how to invoke a custom callback function and pass the full list of answers to that function as an argument.
- [Instructor] In the last lesson, … we introduced the readline module, … and we saw how we can interact with the terminal … using this module, instead of using process standard input … and process standard output directly. … In this lesson, we're going to try to rebuild … the question interface that we built in the last chapter, … but this time using readline. … So, the first thing I'm going to do is … come over to my files and add a new file, … and I'm going to call this questions.js. … And the idea is, we want to have a variable … that can hold our questions, like an array, … and within this array, we want to be able … to add any number of questions, and have those questions … asked to the user through the terminal. … So, we'll go ahead and ask, "What is your name?", … "Where do you live?", … and "What are you going to do with node js?". … So sometimes when I have a coding challenge, … I try to think about what I do … and represent it as a function call. … So, for instance I know that we need to collect …
- What is Node.js?
- Installing Node.js
- The global object
- Importing the core modules
- Creating custom events with the EventEmitter
- Reading, writing, and removing files
- Working with file streams
- Creating child processes with the exec and spawn functions
Skill Level Intermediate
Node.js: Real-Time Web with Socket.IOwith Emmanuel Henri1h 24m Intermediate
1. What Is Node.js?
2. Set Up Your Environnment
3. Node Globals
4. Node Modules
5. File System Basics
6. Files and Streams
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.