Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JoeFerrucci/c300c613b0380b20a45be18b2b0fd067 to your computer and use it in GitHub Desktop.
Save JoeFerrucci/c300c613b0380b20a45be18b2b0fd067 to your computer and use it in GitHub Desktop.
client-api training
API CODE:
===========
GET api/:id/changes
route.get("api/:id/changes", function() {
queryMongoDB(USER_CHANGES).filter("id == %@", id, function(changesData) {
queryMongoDB()
# wipe USER_CHANGES for :id
# return data to client.
})
});
route.put("api/:id/changes", function() {
# // update user profile
# update USER_CHANGES
# return success to client.
})
USER_CHANGES
id | changes
-------------------
7 {"photo": "www.someS3awsurl.com", "status": "OOO"}
3 "photo"
27 "jobtitle"
CLIENT CODE:
=============
let JSON = changesFor(id: 7) # call GET api/:id/changes
api.changes(id: 7, payload: {"photo": "www.someS3awsurl.com"})
api.changes(id: 7, payload: {"status": "OOO"})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment