Create a commandline todo list app that you can use from your terminal and that will keep track of things you need to do.
node todo.js add "eat bak kut teh"
1. [ ] - eat bak kut teh
node todo.js show
1. [ ] - eat bak kut teh
2. [ ] - go shopping
3. [ ] - feed dog
4. [ ] - swim practice
5. [ ] - code app
6. [ ] - meet gabriel
Create and install some things:
npm init
npm install jsonfile
touch data.json
Put the following code inside data.json
:
{}
Now you can start coding the index.js
file. The one provided has a basic jsonfile example in it. (you should get rid of this basic example as you code your app)
Implement the deliverables in the order shown above.
-
Add to the list. (It starts empty)
-
Show all the items in the list (Once you have something inside it)
Hint: you MUST add a data structure into the json file: the array of todo items you want to track.
So it should look like this:
data.json:
{
"todoItems" : []
}
Hint:
Which jsonfile
library functions will you use for each of the above deliverables?
Hint:
What will the JSON look like inside the data.json
file when your app is done running an add
?
node todo.js done 4
1. [ ] - go shopping
2. [ ] - feed dog
3. [ ] - swim practice
4. [x] - code app
5. [ ] - meet gabriel
6. [ ] - eat bak kut teh
Add a column named created_at
with data type date and display the date the item was added. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
Add the ability to permanently delete an item.
Add a column named updated_at
with data type date and display the date the item was marked completed.
Use an ascii art generator to add style to your app: http://patorjk.com/software/taag - here you could use the ES6 string interpolation syntax.
There are frameworks to make a completely dynamic command line app. Use a framework to make the app interactive: https://medium.freecodecamp.org/writing-command-line-applications-in-nodejs-2cf8327eee2