I access my server using PHP and this object literal form. This object literal is converted to JSON and sent to the server where it is converted back to an object. From there I read the model property to know which model to run. Also, contained is the user token, so I know which user to retrieve model data for.
$A.Packet.define({
model: null,
client: {},
server: {
smalls: {},
feed: {},
favorites: {}
}
});
Basically the strategy is encode information into an object literal, json encode it, send it, decode it, apply server logic and send back the data in JSON form.
This is all abstracted into running
$A.Packet.push({model: self.Name});
and then pre(packet)
and post(packet)
ajax methods run automatically.
How can I integrate this style into backbone?
According to Backbone I can over-ride the sync()
function but I want to understand best how to integrate things before hacking a way.
My code has already been converted to MV* form but I'm using dummy data to test the front-end. I want to bring the back-end up now.
The dev site is here:
Related
How to override Backbone.sync? - However I don't want to use localStorage yet and I have no use for the 4 methods it states I must implement.
All of my operations are POST JSON calls which do what they need once they hit the server.