Created
May 2, 2016 05:32
-
-
Save JoeFerrucci/c300c613b0380b20a45be18b2b0fd067 to your computer and use it in GitHub Desktop.
client-api training
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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