The second week of Backend begins! I found that last week felt pretty difficult at the beginning, but by the end I was feeling more confident. With learning anything new, things just get easier with practice, so I wasn’t too worried about this week…in fact, I was looking forward to it!
As usual, I worked on some code katas between 8:30 - 9:30. Currently we’re working on data-manipulation katas, which should help us with the sprints we are working on.
The first lecture of the day introduced us to Node-postgress, which we would be using today.
node-postgres is a collection of node.js modules for interfacing with your PostgreSQL database. It has support for callbacks, promises, async/await, connection pooling, prepared statements, cursors, streaming results, C/C++ bindings, rich type parsing, and more ~ https://node-postgres.com/
We’ve learned about so many of these modules and libraries already! I try to keep links to them organised in my Chrome bookmarks, but I should probably made myself a better list so I can see what they all do at a glance.
It was now time to start our 2-day Rated Restaurants sprint! This would involve everything we’ve learned about so far in backend including; a postgreSQL database, Express API & server, testing and more. We needed to create a database of restaurant information (like restaurant names, areas, ratings etc) and build our API to access this information. We got put into pairs and got started! Surprisingly, I felt pretty comfortable with this sprint; my buddy and I both seemed to be on the same page with what we remembered and I think we worked pretty well together.
We had another lecture in the afternoon which was pretty lengthy, but it was a really good introduction to Supertest; basically about how we can use it to run our tests and how we can effectively structure our tests. We learned about the happy path which is a default scenario featuring no exceptional or error conditions. In this case, we would be testing that the functionality works as we expect it to.
Most of the the day was taken up by lectures, but my buddy and I managed to get our database fully built, plus we started building the foundations of our API too. I’m really happy with what we’ve been able to cover today and am looking forward to completing it tomorrow! It’s felt like quite an information-heavy day today, so I’m just going to rest my brain tonight.
I woke up feeling good about today and looking forward to completing our project. After morning kata time, there was just one lecture today which was mostly about error-handling. Yesterday we learned about the happy path, so today we learned about the sad path, which is of course the opposite of the former. In this case, we would be testing for when things could go wrong (like the user providing an incorrect url or query) and ensuring that the correct error response can be provided. I really enjoyed the example that Jim showed up with a Harry Potter spells database!
After the lecture, we had pretty much the rest of the day to work on our project, completing more of the tasks and implementing some error handling. Following the MVC pattern), we managed to write the functions to GET some information from the database, as well as POST some information to the database. We ensured that our development was test-driven, by planning out what outcome we expected and writing the tests before diving straight in and building the functions; my buddy was really good about ensuring all tests were written!
We hit a little snag towards the end of the day, where we experienced an error for about 20 minutes and we couldn’t figure out why our code wasn’t running…turns out it was due to a pesky forward-slash (/)!!!! Honestly, the most frustrating errors are always caused by typos! My laptop also had a stroke from CPU overload, so I had to turn it off and on again (and uninstall some extra stuff)!
Finally, by the end of the day, I was really proud of everything we’d achieved today. We didn’t manage to finish every single task (I think it would have been impossible in the time) but we had a really good crack at everything! I can’t remember if I’ve mentioned this before, but we usually have a little round up for half an hour at the end of the day with our mentor group, where we talk about how our day went. This was definitely one of the more positive round-ups I’ve had during backend!
I spent the evening watching some inspiring student stories on Northcoders Youtube channel and reinforcing my belief that one day that will be me!
Day 1 of a new 3-day sprint today! The overall goal is to build a database and API via test-driven development, which holds information on shops, owners and items. I’m slightly nervous about the extent of what this one will involve, plus there’s that slight social anxiety that always comes when working with someone new.
In today’s lecture, we were introduced to Knex; a library for SQL database queries. From my experience so far, these libraries do tend to make life easier with their built-in functionality. Today Knex was going to help us to seed our database, which means to populate the tables with data.
We were paired up and jumped onto Zoom to get started on our project. As always, we were taking turns in being driver and navigator. We needed to get the database completed today, so that we can begin building the API tomorrow. My buddy said he felt a bit nervous about the extent of the project too, but we both seemed motivated to get the work done.
Overall I think we had a really good day today. The documentation for the Knex methods is well-written, so we managed to use them just fine. We also needed to write some functions to reference specific parts of the data, but those morning code katas we’ve been solving helped us to do that! We built our database and seeded it with all the data we’d been given. We even started some of tomorrow’s work and started building the very beginning of our API! Today felt like a really intense work-filled day though, so it was a relief when 5pm came around.
Today we learned how to use Knex queries within our API to help us with more complex queries. We used test-driven development while creating the different endpoints for our API and ensured to test for happy paths (the correct result happens) and sad paths (the scenarios where things will go wrong eg. the user requests the incorrect url). Most of today was a blur because, again, I feel like we did so much and we don’t have many breaks really. Very productive day again though!
Date night tonight; my boyfriend took me for beer and fried-chicken. It’s nothing fancy or expensive, but I really look forward to this little treat in the week.
I woke up feeling glad it was Friday, as we’ve worked really hard this week and I was feeling pretty tired…especially as I keep dream-zooming which makes me feel sleep-deprived!
In today’s lecture, we learned more about error-handling and how we can catch and handle errors using Knex. We also learned more about error-handling middleware functions and how these operate as a chain to ensure that all errors can be caught. I also learnt that asking if we need to test for a 500 server error is a very silly question…
We started adding methods to our API and managed to create a few GET methods (to acquire specific information from the database and sort it in varying ways such as by age or price) and I think we just about managed one POST method (which allows the user to post a new item to the database). I was a little worried that I still haven’t had the chance to practice more methods like PATCH or DELETE, but the tutors ensured me we will be using these next week. We fully tested the methods that we did use though, so the experience of writing so many tests whilst building this API has been super useful. I’m quite relieved to finish work on this current project now and I’m looking forward to testing my knowledge next week…
I actually also completed #100DaysOfCode on Twitter today! It’s a challenge to tweet about your progress during 100 days of consecutive coding (although I have had breaks during weekends sometimes) and I’m pretty proud of myself for sticking to a challenge! In fact, I’m going to start another round next week I think because I find sharing my progress is pretty motivational. You can follow these tweets at @TiaEastwood.
Phew! Week 2 of backend is complete! I’m definitely having a rest this weekend.
My boyfriend and I had planned one day every month to play DnD with our friends. However due to the pandemic and rising infection rates, we can’t go and visit our friends right now, so we decided to play DnD via Zoom instead. I swear I spend my whole life on Zoom these days. It was fun though! The four of us ended up playing DnD for a whole 8 hours! I play as a tabaxi rogue and I enjoy being super stealthy.
I dream-Zoomed again last night. I dreamt that I was put in charge of arranging the next DnD session via Zoom, but I kept accidentally inviting my entire bootcamp cohort to it and everyone was getting annoyed.
It was sunny today, so I went and met my mum outside and we went for a walk. Getting outside and away from a computer screen was definitely needed!