I want to create a simle online todo list where I can fill in 2 fields for example “date” and “task” hit submit and then add it to a list. Here’s a quick mockup:
“date” = __________
“task” = __________
date: 16/07/2018 task: do laundry
date: 15/07/2018 task: go shopping
date: 15/07/2018 task: work out
The question I have is what I will have to learn for this project. I think I need mongoDB/mongoose to create a database and store all of my list items and nodeJS for the backend, are there any more I need to know?
I can create a backend app that has pretty much the right functionality but I can only interact with it (add/delete list items) via my console and only store it in a json file, and I can create a front end app that looks right. How can I connect the two and create
clickable buttons to remove a list item,
a text field that will add an object with a date and a name to my json file
a way to convert every object in my json file into its own todo list item with border and style etc.
I dont really need specific answers just a few keywords I can look up that I will need tto use for my project.
thanks in advance
You do not need a database per say. You could create a text file which contains the data of each todo item on a separate line with the date and task separated by some kind of delimiter (ie. |). Each line would also need some kind of unique identifier like a number which would also be separated by the same delimiter. You would need the unique identifier, so if you wanted to remove the item later or mark it “complete” (which would be another thing to store on the same line.
This is all possible with just nodeJS. However, it would be easier with a database like mongoDB.
Depends, if you are doing it for study purpose, so good, but if you think to provide it as product, I believe you should do some more thing like security, privacy ,… too
As mr Dawson mentioned, you may take some help of files instead of a database. And a quick note you may consider
Please note if user could send you a content that comes with the delimiter you use(here like pipeline suggested), so it could make some problems fo you if you just take results and save them as they are. please considering file encoding, maybe base64, or escape special chars you use for delimiter.
Yes indeed, not sure how does node js mongodb wrapper works, but considering SQL-injectino too.
Also remember to validate data on server all the time, this is very easy to fool the client to send a invalid data to your server. Always remember, if you can hack your system, so everybody can too.
Of course you never trust data which comes directly from the user. It must be cleansed and/or validated before adding it to a database or text file.
The pipeline was just an example. The code for the backend would need to encode any incoming character being used as a delimiter on the back end in order to avoid messing with the delimitation of a line’s data values.