My JavaScript Project

Michael Martinez
2 min readJun 16, 2021

If I’m being honest, I felt quite a bit overwhelmed starting this project. Even though I felt like I understood what I had learned over the past several weeks, putting it into practice starting off my project felt like a huge step forward. The feeling was only temporary however. After I initialized my starting project folders and began piecing together my index HTML, CSS and js files, things began to quickly fall into place. Everything suddenly made total sense as I took advantage of the java script I’d learned to create what I thought was a relatively good looking web app, considering my experience.

My first obstacle was setting up the serializers. While I understood how to use them, it took some careful thinking about which pieces of data I would utilize and which I didn’t need cluttering up my API for each resource. Inm addition, setting up the active record relationships to display correctly was ultimately quite easy to do. At first, I had thought I needed to setup relationships between my newly created objects needed to be done in the initial post request, I quickly realized all I needed to do was just set it up on my back end as I had learned to do in rails. It took no time at all to set up my fetch requests and test out my freshly setup serializers. Retrieving my data proved to be no issue at all. I then setup my external API to assist in seeding my own.

My next challenge then happened when attempting post requests. I realized I was getting an extra copy of the data when submitting my post request to my back end. Initially, I had though it to be an issue with my serializer, however upon placing a byebug to check what parameters I was receiving, I came to realize that the data being passed through was not formatted correctly. I found this to be an issue with my strong parameters. A quick google led me to discover that when using scaffolds, if no attributes are initially specified, the strong parameters will be created with a fetch method. Changing these to permit/require methods quickly proved to be the solution. The data made it through and my objects were created and inserted into my database, while my front end received the resulting response.

--

--