http://en.wikipedia.org/wiki/Mobile_Backend_as_a_service
www.domain.com/collection/entity
POST /word - write a new word
GET /word/uuid - read an existing word
GET /words - read all the words
All the functionality is abstracted and encapsulated in an object
var options = {...}; var client = new Usergrid.Client(options, function(){...}); client.createEntity(options, function(){...}); client.getEntity(options, function(){...});
You use the object's methods to access the service
http://apigee.com/docs/api-baas/content/sdks
http://apigee.com/docs/app-services/content/installing-apigee-sdk-javascript
https://accounts.apigee.com/accounts/sign_up
https://accounts.apigee.com/accounts/dashboard#/
https://apigee.com/appservices/#!/org-overview
http://apigee.com/docs/api-baas/content/sdks#javascript
After downloading SDK and putting it on Desktop... $ cd ~/Dropbox/pcs $ mkdir afe-apigee-sdk-demo $ cd afe-apigee-sdk-demo/ $ mkdir js $ cp -R ~/Desktop/apigee-javascript-sdk-2.0.9 js $ touch js/main.js $ touch index.html $ touch readme.md $ git init $ git add -A $ git commit -m"initial commit with Apigee JS SDK"
<html>
<head>
<title>Does it work?</title>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="js/apigee-javascript-sdk-2.0.9/apigee.js"></script>
<script src="js/main.js"></script>
</head>
<body>
<h1>Does it work?</h1>
<div class="result">
<div id="response"></div>
</div>
</body>
</html>
// in main.js, in a function var client = new Usergrid.Client({ orgName:"XXXXXXXX", // use your organization appName:"sandbox", logging: true, buildCurl: true });
Get your organization from dashboard.
Create the API object
var options = { type:"entry", word: "foo", def: "See 'bar'." }; client.createEntity(options, function(error, result){ if(error) { console.log("There was an error!"); } else { console.log("It worked!"); } });
Use the API object
Use the API & entities to update the DOM.
Follow along with the coder...
1. Refactor the glossary web app
First: store/retrieve the whole dictionary
Optional: store/retrieve words/definitions
2. Refactor the Kittens web app
Image uploads to Apigee
Style guides
Kitten site demos
Retrospective