Moving from Local Storage to Cloud Based Storage For Your Mobile Apps 

Justin James

@digitaldrummerj

What are we really talking about?

Take the confusion out of how to get data

to our mobile application

 

Reduce the mundane work of creating a REST API

Technologies Covered

  • Browser Local Storage

  • Firebase

  • Back&

  • Strongloop

Agenda for  Each Technology

  • Overview

  • Why Use it?

  • Limitations (if any)

  • How to use it 

Overview

  • Browser based storage

  • Key/Value Pairs

  • Per Domain and Protocol

  • Storage Limit of at least 2 MB

  • Never Transferred to Server

Support

Why Use?

  • Zero Hosting Cost

  • Available on All Devices

  • Data Size is Low

  • Don't Need Cross Device Sync

Limitations

  • Storage Limit < 10 MB

  • Storage Limit Not Consistent

  • No Cross Device Sync

  • Data is string based

  • Minimal Features

How to Use?

//string
window.localStorage.setItem("name", "Justin");

window.localStorage.getItem("name");


//Complex Object
window.localStorage.setItem("profile", JSON.stringify(data));

JSON.parse(window.localStorage.getItem("profile"));

Backend-as-a-Service

FOCUS ON WHAT REALLY MATTERS

Beautifully Crafted Front Ends

Full Server for

your application

No Installations

Overview

Realtime

Data

Authentication

Hosting

Real-Time Database

  • NOSQL Database

  • Every Client Syncronized

  • Auto Scaling Internally

  • SSL by Default

  • Works Offline

User Management

Hosting

  • Static Asset Hosting

  • SSL by Default

  • Deploy in Seconds

  • Custom Domain 

Why Use?

  • Real-time Communication

  • SDK for Android, iOS, and Javascript

  • Application Hosting

  • Offline Support?

  • Don't have to define schema upfront

  • SSL By Default

Limitations

  • NoSQL (confusing if not used before)

  • Overwhelming Amount of Docs

  • Offline Support?

  • Implementing Security is Confusing

  • Lots of coding for Logins

  • Lots of callbacks

Get Data

// Using AngularFire
var projectRef = new Firebase(FirebaseAppUrl);

// get list
var globalProjects= $firebaseArray(projectRef);

// get ID
var rec = globalProjects.$getRecord("foo");

Modify Data

//post
globalProjects.$add(recordOrItem)

//post and put
globalProjects.$save(recordOrItem)

// delete
globalProjects.$remove(recordOrItem)



Add Child Data

var ref = globalProjects.$ref();

var project = ref.child(projectId);

tasks.push({});

Update Child Data

var ref = globalProjects.$ref();

var taskObj = ref.child(projectId).child('tasks').child(taskKey);

taskObj.set({});

Delete Child Data

var ref = globalProjects.$ref();

var taskObj = ref.child(projectId).child('tasks').child(taskKey);

taskObj.remove();

Instant Backend in the Cloud

Overview

Cloud Server

Free DB

Server Side
Logic

User

Mgmt

Data Model with REST Api

Build Model in JSON

 

Back& will automatically:

  • Create a Database

  • Generate a REST Api

Data Model Built Visually

Model Built Use Web Based Editor

 

Back& automatically updates JSON model

Generated Rest Api

Server Side Logic

  • On Demand Or Triggers 
     

  • Can Run:

    • Javascript

    • Send Emails

    • Execute SQL

Custom Queries

NoSQL or SQL Scripts

Unique url

REST Api

Test Results

User Management

3rd Party Services

Database Integrations

Why Use?

  • Paging/Sorting/Filter Out of the Box

  • Easy to implement service side logic

  • Use Own Db but Back& REST API

  • Application Hosting

  • Back& Manages the Infrastructure

Backand Quick-Start Apps

Limitations

  • Back& is the new kid on the block

  • Only General DB as a Service Concerns

    • It is a blackbox

    • No Control Over Built-In Db Settings

    • Someone else is hosting your data

REST API - Get

return $http ({
  method: 'GET',
  url: Backand.getApiUrl() + '/1/objects/' + objectName,
  params: {
    pageSize: 20,
    pageNumber: 1,
    filter: null,
    sort: ''
  }
});

SDK - User Management


Backand.signin(email, password);

Backand.signup(
    firstName, lastName, 
    email, password, confirmPassword);

Backand.signout();

SDK - Social Logins

Backand.socialSignIn(provider);

Backand.socialSignUp(provider);

Overview

  • Bring Your Own Database (Not dbAAS)

  • Open Source Framework Designed for APIs

  • Quickly Create Models 

  • Automate Creation of REST API

  • Very Detailed/Configurable Security Policies

Supported Databases

Why Use?

  • Full Control of Deployment

  • Mix and Match Data Sources

  • Fine Grained Security Configuration

  • Open Source

  • Easy to Change Data Sources

Limitations

  • Security Out-Of-Box is Confusing

  • Loopback CLI Buggy on Windows

  • Most Management of Infrastructure

  • Not All CLI Features in GUI

  • Have to have a Strongloop account

  • Foreign Keys Not Created in DB

Using Overview

$ npm install -g strongloop

$ slc loopback

$ node .

//Web GUI (No Relationship Support)
$ slc arc

Using Generate API

$ slc lookback:datasource

$ slc lookback:model

$ slc loopback:property

$ slc lookback:acl

$ slc loopback:relation

https://docs.strongloop.com/display/public/LB/Command-line+reference

Links

thank you

Slides:

http://bitly.com/easy-api




http://twitter.com/digitaldrummerj

http://digitaldrummerj.me

Data Driven Restful Api Creation Made Easy Breezy

By Justin James

Data Driven Restful Api Creation Made Easy Breezy

Takes a look at the pros and cons of local storage, back&, firebase, and strongloop

  • 1,424
Loading comments...

More from Justin James