It used to be that when you wanted to use data for one of your weekend or side projects, you would need to go through countless “Hello World” and ToDo List tutorials (don’t get me started…), learn MongoDB, MySQL or some other backend solution that required installing, failing to install then reinstalling some npm packages and may the coding gods bless you if you were using a Windows machine.
Pictured above: Windows user trying to install MongoDB
You see data couldn’t just be thrown about in the browser, it needed a safe place to reside so no unscrupulous user could just take and bake your sweet sweet data. No, it needed fancy tables and Structured Query Language (SQL) to access it then some server side language like PHP or Python or C# to connect your HTML with said sweet data. These are still great(?) options especially when you’re a big company that needs the security and capability to handle millions of rows worth of data… but you’re not a big company, you’re you and you just need something to take in some data for you and your users (which might also be you).
Enter FireBase. Go on, just enter. Here are the steps:
- Create an account
- Create an app name
- Start adding your sweet data
In the head of your HTML just add the script:
Here’s an example. Create an html page with an input and a button:
<button onClick=”fbPush”>FireBase Me</button>
var testData = document.getElementById(“userInput”)
var fb = new firebase(<insert your url here>)
The same way in which you would store data in a JSON array is exactly what you’re doing with you’re FireBase array only this array’s data won’t be cleared when you exit your browser. Sweet!
That’s all folks. And by all, I mean not even scratching the surface of what this bad boy can do. Simplifying the way in which developers can create, read, update and delete (CRUD) data can help you build an app quickly and with minimal computer fisting. I truly hope 2016 becomes the year of the API as a backend because even though I really enjoy writing SQL (seriously) sometimes I just want to get shit done.
If tables are more your thing, then check out AirTable which uses the traditional table version of the API as a backend. I’m willing to bet we will see a few more of these alternatives pop up as the year progresses.