Listing notes
Now that we've made some awesome progress on debugging, let's go back to the commands for our app, because there is only one more to fill out (we have covered the add
, read
, and remove
commands in the Chapter 3, Node Fundamentals - Part 2, and this chapter, respectively). It's the list
command, and it's going to be really easy, there is nothing complex going on in the case of the list
command.
Using the getAll function
In order to get started, all we need to do is fill out the list notes function, which in this case we called getAll
. The getAll
function is responsible for returning every single note. That means it's going to return an array of objects, an array of all of our notes.
All we have to do that is to return fetchNotes
, as shown here:
var getAll = () => { return fetchNotes(); }
There's no need to filter, there's no need to manipulate the data, we just need to pass the data from fetchNotes
back through getAll
. Now that we have this in place, we can fill out the functionality...