How time flies! It’s already the first day of Backend! Now begins three weeks of us learning all the important stuff that goes on behind the scenes of your favourite websites and apps; such as servers, databases and APIs.
Also over the weekend, we set up a workstation for me in the bedroom so I can work with less distractions. There’s no getting away from this little gremlin though…
Last week we started writing HTTP servers the long and confusing way from scratch, which was essential in order to understand what was going on under the hood. However, now we were sre introduced to frameworks which are (hopefully) about to make our lives much easier!
With a myriad of HTTP utility methods and middleware at your disposal, creating a robust API is quick and easy. -expressjs.com
The pair-programming task for the next two days is to build a simple web server and API using Express. We were given data about pets and their owners, and we would need to be able to get this information, add new information, edit it, or delete it; also known as GET, POST, PATCH and DELETE.
My pair-programming buddy and I were both struggling with the tasks and it took nearly all day just to get the server up and running. I think I struggled last week too and didn’t get as far as some people, so I didn’t feel like I’d even had much prior practice of doing it the long way. We did ask the tutors for help (and they were very helpful as always), but even after that, I just don’t think it was clicking for us.
Overall, this felt like a really frustrating day. I can’t say I’m looking forward to tomorrow, but I’m just trying to stay positive and believe that more practice will make things clearer. I spent the night reading through the code we had written and making sense of it.
It is now day 2 of the pair-programming project we started yesterday. First we had a lecture about how to create middleware functions and routers. We now had to refactor our code to include these things.
It was another difficult day really, but we did manage to create the routers and middleware functions. I actually felt like I understood these too, so that was a plus. As for the rest of the project, we managed to complete the first task of using a GET request to retrieve information from the server, but didn’t manage to do PUT, PATCH or DELETE. I’m worried in case I don’t get a chance to practice these again, but I’ll just have to figure them out on a later project. I’ll add these to my list of homework tasks for now.
Today’s subject is Promises, which I was looking forward to as I’ve seen them before and I know that we can use them instead of the confusing callback functions that we’ve used previously! I felt like I would hopefully have a better day than I did the last 2 days anyway.
A Promise is a proxy for a value not necessarily known when the promise is created. It allows you to associate handlers with an asynchronous action’s eventual success value or failure reason. This lets asynchronous methods return values like synchronous methods: instead of immediately returning the final value, the asynchronous method returns a promise to supply the value at some point in the future. -MDN
So after the lecture introducing Promises, we were given a task to work on by ourselves until lunchtime. The task was based on a server (about cats!) that we wrote last week, but now we needed to re-write it, but Promisified. I liked that I got some time to work on something by myself for a little while before pair-programming in the afternoon, as it took away a little bit of the anxiety about being unsure and feeling stupid in front of someone else.
After lunch, we were paired-up and given a 2-day sprint to work on, based on a music API. Using Promises, we needed to get certain bits of information via the server, such as specific songs or lyrics from different endpoints. We also learned how to use Axios, which is a Promise based HTTP client for the browser and node.js. We mainly used it for making GET requests, to get the information we needed via a Promise. I thought Axios was cool and I liked using it. I’m enjoying learning about other resources that can make our work more efficient and readable.
I quite enjoyed today and am feeling positive about tomorrow!
So I already dream-code…it seems that I now also dream-Zoom. Last night I dreamed that I was on a Zoom call all night and now I feel like I’ve had no sleep because of it! Yayyy.
Today we were continuing with our music API sprint, but first we had a lecture about how to use Promise.all to pass multiple pieces of information along a Promise chain. The example they showed us in the lecture was using SWAPI, which is a really cool Star Wars API! We could use Promise.all to get multiple pieces of information at once (this is still asychronous, but the Promise is completed when all the information has been acquired) such as spaceships, character information, planet information etc.
Most of the errors we encountered were due to typos or silly things like that, otherwise I think we did pretty well with our pair-programming task. I think it’s rare for anyone to finish absolutely every task, but I think we gave it a really good go and I feel like I’ve really learned a lot in these last two days! It’s amazing to think I can already build a server and API after only learning about them a week ago!
Every night after bootcamp this week, I’ve been studying until late. Tonight though I’m giving myself a night off; thursday night has now become the night that my boyfriend and I go out for a drink and spend some time hanging out together. Sometimes I need to remind myself to take a break from studying so I don’t burn myself out.
We were beginning a new subject today; databases! Today’s lecture was the introduction to SQL, which stands for Structured Query Language. SQL is a language that lets you access and manipulate databases. To begin our day, we were advised to complete some of the tutorials on SQL Bolt to familiarise ourselves with it. This is actually a really good site that I would also recommend you to check out if you are learning SQL yourself.
After this, we had a lecture to discuss what we’d learned already and what we were going to be be doing. We would also be using postgreSQL in our projects, which is an object-relational database system that uses and extends the SQL language.
No pair-programming today! Pair-programming is very useful, but I’m glad to change it up a bit today so I can re-charge my social battery a bit. We were working on a 1-day sprint by ourselves, using SQL to create a database of Italian recipes. We had to create a database with tables to hold information about certain aspects of foods, such as what type of food it was, or if it was a starter, main or dessert etc. I was quite enjoying this sprint! Although SQL needs you to be VERY precise about how you type things (or you’ll get an error!), I like how it’s written in a very easy-to-read way.
We had another lecture in the afternoon to discuss the different ways that tables in a database can relate to each other, through One-to-one, One-to-many and Many-to-many relationships. Many-to-many sounded complicated at first, but most of that was learning how to create a junction table in order to join multiple tables together. I didn’t manage to complete all the tasks by 5pm, but I kept on working until 9pm as I felt really motivated to carry on. I managed to create a junction table to link various ingredients to the recipes that they were used in. I felt pretty pleased with myself that I got this done as I now have my own example for reference.
…and with that, the first week of Back-End is over! Honestly, I feel like it’s flown by because I’ve just been so busy! It’s not been easy, but I haven’t cried yet, so it hasn’t broken me! I feel like we must have covered the main areas now with servers, APIs and databases, but I’m interested to see what we’ll be introduced to next week.
Saturday was a pretty chill day. I didn’t look at any code. I just got some DIY bits done around my flat and played Dragon Quest XI.
On Sunday, I really wanted to get outside, so my boyfriend and I went for a walk and had a little picnic lunch. It’s still pretty hot and suny for September. Then when we got back, I did some more of the tutorials on SQLBolt and published this blog post. I know that weekend doesn’t sound super exciting, but I do feel quite well rested now! I’m mentally preparing myself for potentially quite a challenging week ahead.