Day 39: Reviewing sequelize
Another week ahead and I am extremely excited by the new things we are discovering 😎, we started today’s class by reviewing the structure we need to follow in order to use the package of sequilize. We saw how our config folder changed and now we have a cong.json folder (if we write in our terminal ‘sequelize init: config’)📝, where we will put our credentials in order to have access to our DB.
Then we did an exercise where we transform an ORM page into a sequlize form so we can execute MYSQL without actually writing in this language👏🏼, which I actually find fascinating. We then created models of validation for our tables using sequilize, this is a great way of making the data thas is being introduced to our DB as «clean» 🧼 as possible.
Finally, we did a couple of exercises of validation and we added «flags»🏳, which means that we set values of true or false to booleans. Tomorrow we will work with the association, which is a way on sequilize to create relations, like JOINS in MYSQL🌟.
Day 40: Association in sequelize and first brainstorm of the group project
Today we started class reviewing the folder structure we need to have in order to have sequelize execute in our database and we also test our routes using postman 👩🏼🚀. Also, our teacher encouraged us to always catch errors ☄️ in every function of our routes so we know where and what the problem is and also to show to the user if necessary by «res.SendStatus(…status code….)»
We then worked tried writing association commands, where we «join» 🙌🏼 two tables through shared value. Take for example authors and posts on a blog, we created a one to many relationships🧩, by establishing that, an author can have multiple posts.
Once the association was created on our models we included those values on our routes 📊 so we can then display those connections on the front end when the user searches 🧐.
Finally, we created a seeds folder written on js, which normally we wrote it on MYSQL and we then run it in our server 🍝, but now we load our seed DB on or config JSON folder. This makes our deployment to Heroku more smooth than before 🌟, as we just need to link it to our JAWSdb using our code. Before the class ended we worked a little on our group project as we are presenting it on Tuesday, cant wait to start 🤗!
Day 41: Group project update and checking for errors
90% of the day off today was a focus on organizing and developing the group project 🙌🏼, in this first stages, we need to focus on creating the best bases so we can construct a functional app 🤹🏻♀️. The first thing we did as a team was to establish what our MVP was and think about two to three layers of other functionalities we can add 🚀.
Our app is focused on mental health 🧠, and we base our functionality on research that proves that going outside helps the patients to feel better. So, we decided to create an app that through a test it will display a tailored location, so they can go outside to a place where they can experience some joy ☘️.
Once we defined the idea and the MVP, we decided to concentrate on creating a GitHub repository that will be functional and that will give us as little problems 🧐 as possible when merging. In this process 📄, we also create the basic structure of folders that we think our app might need and then we all pull it to our personal branches so we can start working on it today.
Finally, we were introduced to some techniques and packages that we can use in order to test if our app is going to have errors ☄️, some of these testing technologies are ESLINT and TRAVIS. Also, our teacher talked about two ways where we can test our code, one specific methodology like unite testing and another that tests 📈 the whole app called end to end testing. There is not a unique right way to test an app, but if something is true is that the more we test it in developing mode, probably we are going to have fewer issues in production✌🏼.
Day 42: Challenges with the group project and login overview.
The week is almost over and on Tuesday of next week we are presenting the group project, and as always, when we are in the middle of the project challenges 🤹🏻♀️ start to come up. But, this cannot bring us down we need to understand our errors ☄️ and try to make changes to adapt to new situations. In particular today, we had issues with the API of google maps and our user key 🔑 , I hope that by the end of tomorrow we are able to solve it.
Also, another interesting thing that our teacher does 👩🏼💻, is that during class our teacher gives us masterclasses of particular things that we can apply to our project, like for example a login page 💾. It’s interesting to see how such a simple concept of logging in to a webpage can be so challenging to develop🏗 , as you need to connect to your DB, make sure the password is the one given to that user and at the same time keep it encrypted. In order to make this process work, we used different npm packages such as Passport (for the verification) and bcrypt-nodejs (for the encryption ).
Day 43: End to end testing and connecting to our database app
Friday arrived and we continue with our group projects 🙌🏼, we had a stand-up session and talked about things that we could work throughout the day. We were able to add the values that the user inputs into our database 🗄, and also connect to the API of google maps through our API routes.
Also during the day, our teacher shows us how to do some end to end 👩🏼🚀 testing using the package puppeteer and jest-puppeteer, that will then do a test of the params we write on the lines of code 📖, reviewing all the steps using async functions. This was mind-blowing 🧠.