Course lesson

Add Question/Answer Object to our Data with Node.js writeFile

All of our questions have been hard coded so far. We want the user to be able to add a question when they pass the --add flag.

Duration
4 min
Access
Included
Transcript
Retained from source evidence

All of our questions have been hard coded so far. We want the user to be able to add a question when they pass the --add flag.

We will need to use inquirer to ask for a question and it's answer. Once we have a question and answer in hand we will read our data.json file and then write to it with our new question. While we do this, we will assign a unique id to the question based on the length of the array being stored in our file.