For the past couple of I have played around with building an iOS app with Firebase as the back-end for it. I wrote a previous post about the joy that is Firebase, which you can check out. One of the features I am trying to incorporate is taking a picture of an item and uploading it with the post. Well, unfortunately, Firebase does not natively support image uploading. In order to store images with Firebase, you need to first turn them into their Base64 equivalent and store that string value as the value for the “image” key in your Firebase JSON structure.
In the interest of sharing examples of from lessons learned, I have created a demo and write up on how to use the handlebars.js library for processing JSON data returned by an API call and then dynamically display that content on a web page. I deal with JSON data more and more in my work projects and happen to prefer it to XML data, partly because of XML data can be rather large and clunky to deal with. Leveraging handlebars.js allows me to quickly traverse JSON arrays and grab the necessary key : value pairs I need for rendering content. I hope others find this useful. The linked example demonstrates how to use the Gilt API to get current sale items by category, and then use handlebars.js to translate the resulting json data into nice neat little card style objects. Any API that returns JSON data could be substituted in.