Re:Show HN: Todos: Backbone.js example + Google App Engine (...
by cosmorocket on Monday May 30, 2011 @11:18AM
(#2599595)
Thanks for the demo and source. I am trying out Backbone and GAE too. What I wonder about and asked on StackOverflow but didn't get a clear answer is how to join together Backbone on the client side and ProtoRPC on the server side. Do you have any ideas? Thanks.
[ Parent
| on HN ]
Re:Show HN: Todos: Backbone.js example + Google App Engine (...
by joetyson on Monday May 30, 2011 @12:37PM
(#2599783)
There isn't really a mapping between backbones models and protorpc. Backbone.js assumes the model layer is RESTful where protorpc assumes you will make method calls, each via a POST call.
I'm interested in what a model layer would look like using protorpc. One idea is to take a similar path of abstraction as the underlying appengine datastore api does: use protocol buffers to express an "entity". So you might have:
{
entity_type: 'Book',
entity_fields: [
{
field_type: int,
field_name: 'title',
required: true
}
]
}
This would be a proto definition called, "Entity". From here you could build procedure calls that send entities for doing common routines, such as updates, or deletes. If you can make a structure like this work, you can build an api with javascript which hides the protobufs from you all together.. When you call Model.get('Book').create({title: 'My book'}), it constructs the Entity protobuf and calls the remote call for creating a new entity.Just an idea! Also - protorpc is in fresh development, so it's a good idea to join the discussion group and make suggestions: https://groups.google.com/forum/#!forum/google-protorpc-disc...