Home > Parseback

Parseback

Parseback is a project mainly written in CoffeeScript, it's free.

An example of using Backbone.js in a web app with Parse.com as the back-end

To run this Proxy to Parse.com, you will need the following installed:

  • Node.js
  • CoffeeScript (npm install -g coffee-script)
  • Express (npm install express)
  • Restler (npm install restler)

Also, make sure you have created a project on Parse.com. Then:

  • Make a copy of the config (cp config.coffee.example config.coffee)
  • Edit config.coffee to add your Application ID and Master Key from Parse.com

Finally, to run this proxy, simply execute:

  • coffee proxy.coffee

To test it out, you can use curl:

CREATE

curl -X POST -H "Content-Type: application/json" \ -d '{"first": "Brian", "last": "Genisio"}' \ http://localhost:3001/data/People {"createdAt":"2011-11-05T19:11:25.873Z","objectId":"fiIMd53m0j"}

LIST

curl -X GET http://localhost:3001/data/People {"results":[{"updatedAt":"2011-11-05T19:11:25.873Z","last":"Genisio","createdAt":"2011-11-05T19:11:25.873Z","first":"Brian","objectId":"fiIMd53m0j"}]}

UPDATE

curl -X PUT -H "Content-Type: application/json" \ -d '{"middle": "Michael"}' \ http://localhost:3001/data/People/fiIMd53m0j {"updatedAt":"2011-11-05T19:15:25.122Z"}

SHOW

curl -X GET http://localhost:3001/data/People/fiIMd53m0j {"middle":"Michael","updatedAt":"2011-11-05T19:15:25.122Z","last":"Genisio","createdAt":"2011-11-05T19:11:25.873Z","first":"Brian","objectId":"fiIMd53m0j"}

DELETE

curl -X DELETE http://localhost:3001/data/People/fiIMd53m0j {}

If you want to play with the Parse.com/Backbone.js integration, open your browser and piont to http://localhost:3001 and then open your developer console. The equivalent actions can be executed using Backbone.js models:

CREATE

var person = new app.models.Person({first: "Brian", last: "Genisio"}) person.save()

LIST

var people = new app.collections.People() people.fetch()

UPDATE person.save({middle: "Michael"})

SHOW var brian = new app.models.Person({id: "0XH76yfqyc"}) brian.fetch()

DELETE brian.destroy()

QUERY people.fetch({ query: { last: "Genisio" }}) // get only people with the last name of "Genisio" people.fetch({ query: { last: {"$ne": "Doe" }}}) // get only people whols last name is not "Doe"

Previous:DistSys