Hello there.
I spent some time on trying to come up with a catchy statement and I ended up with hello there. Not my greatest work, but thank you for visiting my blog. If you’ve been following along, you might be confused with the title. You’re probably wondering why I’m taking about databases after I said I would talk about Vue.js in my last post… Unfortunately, I lied. Not intentionally, but I thought it was important to tackle the backend first. We will be tackling Vue.js in the next few posts though.
For our program, we are designing a employee clock in and out system based on QR codes. Applications can be usually divided into frontend and backend components. By backend, we’re referring to the server-side of the website where the application stores and arranges data. Generally, users of a website don’t interact with the backend directly. My task last week was to create a database and the required tables for our application. I thought this would be an easy task, but I realized that I was always given a database for most of my projects. Now, I would have to set one up. That’s when I realized …
However, it would be a great experience to learn how to set one up and I can always make a full-stack program in the future with this knowledge. Let’s talk about databases. Why do we need databases? There’s a lot of reasons, but the main one is persistent storage. We want someplace to store our data that’s permanent. For us, it’s going to user information and when users clock in and out.
There are two main types of databases. One is called relational and the other is document based. The more popular one is probably relational and it involves databases like MySQL and Oracle. These databases use a query language such as SQL and are pretty standardized. The data is organized in tables with the columns specifying what the data types are. The other type of database is document based and it involves databases like MongoDB, Google’s FireStore, and Amazon’s DocumentDB. The data is stored as JSON-like documents and similar documents can be grouped into collections. There’s definitely more types of databases out there, but these are the two major groups I wanted to focus on.
For our project, we went with MySQL. It was a database all the team members had experience with. My next question was how do I set up a database and how do I interact with it. This is where a team member was able to help me out. He recommended Heroku. Heroku is a cloud platform that supports multiple languages and it can be used to deploy applications. Also, it lets you set up a database for free which is a huge plus for me.
The resource that helped me the most was a video tutorial on YouTube. There are actually multiple tutorials if you search heroku clear database. Using that tutorial, I was able to set up a MySQL database. I was also introduced to MySQL workbench. This is a database design tool that lets you connect and work on MySQL databases. It has an easy to understand graphical interface and you can even run queries from it.
Now, I have a database. Cool … but how do I connect it to our application? We’re using Vue.js for the frontend and I wanted to set up a system for our backend. Learning a good way to do this was a bit of a struggle. This will be the topic of my next blog post. We’ll tackle the design or system I used to connect our MySQL based backend to our Vue.js frontend.
Thank you for reading,
Manbir
Weekly Movie Pick: The Prestige (2006)