Penultimate Zoo

Homework 2 Reflection

Design

My most notable change I made to my backend was adding an ORDER BY to by get Books endpoint for the books table page. In terms of structuring my backend different, I should probably refactor it to use routers and move each route to a different file. Next time, I will try to do this from the start. As for validation, I only relied on server-side validation. Client-side validation responses would definitely be faster as the response isn't being sent to the server first, but the cons is that if I only relied on that, any bad input that makes it past the client will end up in the database. With server-side validation, at least bad inputs aren't making there way to the database (assuming all the checks were done correctly).

React

I didn't really have too much issue manipulating state with React components. The thing I noticed was when I tried making a reset filter button on the books table page. I had it so the button would reset all of the filter options, and then call the queried GET /books, but I believe state changes after a function is finished (if I'm using the correct term). So I ended up just using GET /books without the queries term. Also had to move the GET call to a different function outside of the useEffects function for the search/filter components. As for types, I didn't really have any bugs, and didn't have to rely on any frequently. I did had to define an interface for Books for the Books table page, but aside from that, not much issues with types in the front end.

SPA VS MPA

I definitely enjoyed using React compared to using a MPA front-end in CS375. Found it sort of similar to using EJS in that my JavaScript is inside of my HTML, which definitely was more more convenient compared to when we started learning how to do server side rendering in CS375, or have to get the IDs of HTML elemnts first before doing stuff when server-side rendering wasn't ideal for a changing page.