The End to BackEnd?

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.

business-man-smash-computer-square

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:

  1. Create an account
  2. Create an app name
  3. Start adding your sweet data

In the head of your HTML just add the script:

https://cdn.firebase.com/js/client/2.4.2/firebase.js

Now you have access to the FireBase API and it’s not hard to start adding data. No need for any fancy backend languages or installing any additional dependencies or packages. If you know how to push to a javascript array then you can start adding data!

Here’s an example. Create an html page with an input and a button:

<input id=”userInput”/>

<button onClick=”fbPush”>FireBase Me</button>

Now for the magic which happens in our JavaScript:

fbPush(){

var testData = document.getElementById(“userInput”)

var fb = new firebase(<insert your url here>)

fb.push({

newData: testData

})

}

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s