From Ruby to JavaScript!

Alexander Petrov
2 min readMar 5, 2021

--

This was the first month that my program had us primarily focus on JavaScript, and after investing three month into Ruby, I was curious to whether or not I would prefer JavaScript of Ruby. To my delight, they are not mutually exclusive, and I made a project utilizing Ruby on Rails as a backend API, and JavaScript as the frontend for a single-page web application. The application is a hub for people to share their ideas with the top level organizations in the world!

With the difficulty presented by bad weather, I found myself without electricity for the first half of my project week, and Flatiron was graceful and complimentary to my situation, offering me an extension, and the ability to repeat this phase of the five month software engineering boot camp. With that in mind, I decided to push ahead, and do my project while keeping up with the next phase, and I am proud to say that I’ve completed my project.

Utilizing Ruby on Rails, I created a backend API that instantiates database functionality to my primarily JavaScript application, specifically by utilizing PostgreSQL. There are routes, models, and controllers, that render JSON to the JavaScript code to utilize. The backend also hosts the database server by running rails s.

Then the JavaScript comes into play. I have three AJAX actions, a fetch for the organizations presented, a POST for the ideas being made, and a fetch for the ideas once they are in the database. The JavaScript manipulates the DOM in such a way, that the page never has to load or reload the window, once it loads in for the first time, making for a convenient and speedy experience for any user.

I learned a lot during this project, and phase, such as creating JavaScript objects, using fetch requests, utilizing JSON with JavaScript and more. I will update this blog once my application is hosted on a website, and until then, thank you for reading, and I hope this was beneficial for you. Thanks!

--

--