Working with APIs is a daily occurrence for developers. Most resources on the internet show how to retrieve this information with Javascript on the front end, I wanted to demonstrate how this can be done on the server-side with Ruby. But you may ask, why do fetch calls on the server-side?
*This post comes just before the brink of completing the Flatiron Full-Time Software Engineering Course. Feels pretty good…anyways. *
Knowledge is only powerful if you know what to do with it. Wisdom is actually knowing what to do with that knowledge once you aquire it. This applies to so many areas of life, and for us programmers, getting data and knowing what to do with it is a daily occurence. Let’s talk about how we fetch data from endpoints, and then how we actually do something useful with that data.
Programming can be tough. App development can be even tougher. There is so much to think about. The planning stage, the actually making it work stage, and finally refactoring. Thanks to Rails MVC and seperation of concerns, it makes it so much easier to keep your code readable for the next developer and even yourself down the road. What I want to highlight in this post is, drumroll, view helper methods!
Have you ever wanted to make a website? I mean like a real website with all the bells and whistles like a functioning database and a log in feature. If you have told be some time ago that this would be possible to create within a matter of days, I would have called you bonkers. With the power of Sinatra, I was able to create a powerful web application of my own within, drumroll please… yes, a matter of days. Let me take you through the 2 things that are still ringing in my head after it all.