Learning the Single life can be tough(Single page application life that is)

Christopher Breen
2 min readMar 13, 2021

This week I completed my first SPA for flatiron school and while i had some experience with javascript before starting at flatiron school What I learn this week showed me I did not know much. For My SPA i decided to build a tool for my gaming something to help keep myself and friends a little more organized. I built an application to manage all the weapons I’ve built while playing call of duty games.

The BackEnd of my application is a rails based api that stores all of my data. It has two models a Game model and weapons model, with the weapons belonging to a game. I then built my own custom method to serialize my data so that my api with display the way I wanted it to look.From there we are able to render our api by running our rails server and then its off to the frontend.

The font of this application only need 4 files to do the job we need. An index.js to handle most of our DOM manipulation, a weapon.js to handle creating and rendering weapons onto our DOM, an Index.html to render all of our js onto the browser and an Index.css to spruce up the look of our application.

The index.js has the bulk of our code and where we fetch data from our api. Using event listeners were able to seed when the user submits and new weapon then call the need functions to render the new gun on our page. This allows for our user to never have to refresh the page to see their weapons added.

--

--

Christopher Breen

Leader in Hospitality turned hopeful coder learning to become a software engineer.