O'Reilly logo

Mastering Backbone.js by Abiee Echamea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Backbone.sync

This is responsible to handle connections between a RESTful server and the Backbone application is the Backbone.sync module. It transforms the fetch() and save() operations into HTTP requests:

  • fetch() is mapped as a read operation. This will make GET to the the urlRoot attribute with the model ID for a model or the url attribute for a collection.
  • save() is mapped as a create or update operation; it depends on the isNew() method:
    • This will be mapped as create if the model does not have an ID (isNew() method return true). A POST request is executed.
    • This will be mapped as update if the model already has an ID (isNew() method returns false). A PUT request is executed.
  • destroy() is mapped as a delete operation. This will make DELETE to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required