This week I was working on my message board app using mocha and chai. I also did a bit of work on an e-commerce app. I really enjoy building an API and I'm looking forward to getting stuck into mongo.
I started the week by making a get function for my app. This function will return all the messages in the API. I also made an update and delete function, these were quite similar because they both collected the data and used it in some way changing it for update and removing it for delete.
On Tuesday I did some refactoring mainly. I had to set the ids because I was finding the ids by their position in the array which caused problems when an item was deleted from that array. So I changed it to use the id of the last item in the array and add one.
Wednesday I added a son file and changed my code to write to it so I could use it as a temporary database. I also solved some edge cases like deleting messages that aren't present or trying to make invalid updates.
I spent Tuesday organising some files, writing my first express test and made the contents of the json file load on the home page. It was nice to see it coming together but I'll have to add Mongo later.
On Friday I did more refactoring and also I made the post function for adding a message to the json file and created a route for it. I also spent some time setting up circle CI for my e-commerce project.
Overall I fell like I got a good amount done this week. Next week I will hopefully do some work on e-commerce project and maybe get the API set up for that.