FINALLY!
After working on a CLI app, I was still feeling murky, struggling to visualize how it's like creating a website. BUT finally I am creating a website like a full-stack developer!
Honestly, this website was not easy since the learning curve was steep for me. What I struggled with.
REST
For some reason this was confusing for me. For example, I was creating a post for the get "/lesson/new". So I named it post "/lesson/new," but later I am told that this does not match REST. I was told that the post route was supposed to be "/lesson." Honestly, I am still confused about this.Associations
I initially created a many-to-many relationship. But to stick to MVP, I decided to only have has-many and belongs-to relationships. By doing so, the tables I also initially migrated had become mixed up. I did notice this mistake until I was trying to create a "current_users" method. When trying to use this method, I would get an error on the browser saying "cannot find table 'join'." It was only then, I realized I had to go back and fix my tables and associations, which made me feel like I had to go back to square one.Forms
Forms shouldn't have been that hard but I learned the hard way that if you do not have the params and right variable, then your forms will not post the way it should. In my controllers, my local or instance variables would be called "lesson" while the params would be called "lessons." At one point, this became too confusing to the point the mix up gave me constant errors I would have to debug.Styling
I wanted to stay true to Separation of Concerns, but unfortunately CSS styling became difficult to do. In my public folder, I tried to create CSS files for each Views page but for some reason the style would not show on the browser, requiring me to directly style in HTML.
Here are all my struggles. Despite all of the challenges, I learnt so much more on debugging and how to become a better detective. More importantly, I became a better Googler. Instead of relying on my current knowledge, I solidified my habit to look up what I was unsure on and this helped a lot.
Knowing that the next project will be another website makes me so excited and I can't wait to make a better one that will look more professional.
Top comments (2)
Awesome, good luck with it!
For 1. there are different HTTP verbs - the ones that are relevant here are POST and PUT. POST requests usually requires you to submit an entire entity, which doesn't exist - implying that it is new resource. So, if I wanted to add a new lesson, I would POST the payload to
/lesson
. The response usually returns where the new resource was created.PUT requests are used for updating a resource, so one that already exists.
Ah I see. I’ve only used PUT/GET/PATCH/DELETE for now but I didn’t know POST was for the whole entity