Wednesday, January 14, 2015

The Database and Sample Data

Going to start building this application by setting up a database and populate it with some sample data.  Not going to worry about authentication, authorization, or validation at this point.

The most familiar database solution is to set up a Structured Query Language (SQL) database, e.g., MySQL. In this example, I will be using a NoSQL, i.e., not SQL, database because it will be quick and easy. In particular, I will be using Firebase.

What is Firebase?
Firebase provides a realtime database and backend as a service. The service provides application developers an API that allows application data to be synchronized across clients and stored on Firebase's cloud.
Firebase - Wikipedia, the free encyclopedia

A particularly important feature of Firebase is that not only will it provide the database but it will also provide the server APIs too.

Getting Started with Firebase

  1. Create a free Firebase <http://www.firebase.com> account and follow the 5 minute tutorial.
  2. Read how to structure data in Firebase <https://www.firebase.com/docs/web/guide/structuring-data.html>. This article is particular important as it is not obvious how to create relationships (e.g., wineries and wines) in a NoSQL database.
Setup Database and Populate It
  1. Create a new empty Firebase app.
  2. Populate the Firebase app with sample data as shown below.  By the way, the trick to creating a nested tree structure using the Firebase "data" screen is to change the browser's URL and load the page, e.g., to create  a winery with the key "key1" use the URL: <https://YOURAPPNAME.firebaseio.com/wineries/key1>.


No comments:

Post a Comment