Day 59 Hard Work Paying Off

Day 59 is in the books! Today all of the frustration and hard work started to pay off. I got ui-router working in my favor. Turns out the version of ui-router that the exercise recommended was in beta and didn’t work properly. Two days later a stable version is working just fine. Once I cleared that hurdle I started to gain momentum.

Making Connections

The challenge of this exercise is to connect the front end reddit clone that we made to an existing express back end. Once I got ui-router working I integrated my front end code and some things started to line up. Certain things were working immediately, but others were broken. I had to go through the back end code and see how they setup their schema so that I could make the necessary adjustments to the naming convention that I was using on the front end. Once I had the naming convention lining up properly the first thing I needed to do was a get request to grab all of the posts from the database and render them to the page. I checked the express routes on the back end to see what route I needed to hit to get the posts. Once I had the route I just did a GET request inside of an OnInit function. OnInit is a function that runs as soon as the component is initialized. Once I did that I had all of the posts displaying on the page! I had to make some more adjustments to regain all of the functionality that I had working on the front end. Just some small tweaks here and there to different functions in the controller. I eventually got everything working again. I also was able to make it so that a user can make a post to the database and the data is persistent. That was pretty cool and not too difficult to accomplish. Angular’s built in http service is pretty easy to use.


My next task is to make it so that a user can edit a post. This requires a new component and view. I will also have to use a service to pass data between components which should be fun. Overall things are coming together nicely. Today I felt encouraged to see some things coming together after a couple of days where it didn’t feel like I made much progress. I’m hoping I can take that momentum into next week. I’m definitely enjoying this project and I’m excited to see what I can accomplish next week. I’ll keep you posted on how things progress. I’ll also be doing a more technical walkthrough of the app once I’m finished so stay tuned for that. Until next time…happy coding!

59 down 41 to go!