K.I.S.S. (Keep it Simple: Sequelize)

My time in Vegas is coming to a close. I have booked all of the necessary arrangements for my move back to Los Angeles. In 3 weeks, I’ll be a Californian once again! I’m about as happy as a dog on a surfboard.

Of course, with great excitement comes great anxiety. I’ll be staying with family and have a decent amount of money saved up, but the idea of moving out-of-state without a job lined up is still frightening. Thankfully, the team at Thinkful provides career services after graduation. My portfolio is just about finished, as I had already done some work on it while I was taking Codecademy courses. Most importantly, I have to finish my final Capstone prior to moving so that it can be on my portfolio, too. It feels a little bit like a race against the clock, but I like the pressure.

Of course, one problem with the somewhat-frantic approach to finishing a project, is that it may take a little longer than normal to take a step back and realize that I’m over-complicating things. For example, in my SQL database, I have two separate tables: Friends and Users. When making a GET request for Friends, I wanted to access some information from the Users table, using data from Friends as a parameter. I thought the best way to do that was to have a GET request for Users nested inside of the response from my GET request for Friends. Here is actual (not really) footage of Amy Poehler holding a visual representation of the route I tried to build:

….and here is an actual screenshot of the route I tried to build:

This is actually a relatively clean version. The further I got into troubleshooting the issue, the uglier the function became. I didn’t take any pictures of the function at its worst. Trust me, it was bad. After playing with it for a little while with Elias, I concluded that there HAD to be a simpler way to do this. I figured I could structure the model to to pull the corresponding information from both tables. I was wrong about the models, but I was on the right track. Thanks to the wonderful, amazing Sequelize docs, I found what I needed. Here is a screenshot of my GET request now:

I’m getting much more comfortable reading documentation, which is great! But it also makes it that much more frustrating when the documentation doesn’t provide the answers I need. For example, my Nav component was rendering a bunch of extra white space, which I probably would have overlooked if it wasn’t severely altering the design of my page.

The “react-text” comments and “ ” only appeared in the Nav component. Long story short, I learned the hard way that copying/pasting code from Apple Notes into Visual Studio Code translates into funky character encoding. The issue was fixed by redoing all of my indenting.

The last hurdle is authentication, which, admittedly, I’ve been avoiding. I have my routes setup to protect certain endpoints and I’m confident that I know what to do with the state. The primary hurdle is making a proper AJAX call from the client. I’m using PassportJS with both Basic and Facebook strategies. I told Rachel that I might ditch the Basic Strategy and require users to login with Facebook, but she wouldn’t allow it.

Moments like this, I’m really glad I joined Thinkful. It was so tempting to try to take the easy way out of projects when I was learning on my own. Rachel keeps me accountable. Rachel (as well as countless other students and mentors at Thinkful) help give me pointers when I’m stuck, which keeps me motivated. The temptation to take the easy way out has mostly vanished, for now I have the confidence to find the answers that I need and help others who are also stuck. I even answered a Stack Overflow question for the first time! I truly feel like I’m part of the Web Development community now.

Thanks for reading!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.