If I have a model named "Book" and a collection named "Library" defined as below:
Book
app.Book = Backbone.Model.extend({
defaults: {
title: 'No title',
author: 'Unknown'
}
});
Library
app.Library = Backbone.Collection.extend({
model: app.Book,
url: '/api/books'
});
When I call BookInstance.save()
how does it come up with the URL to use? Does it derive it from the collection?
In Backbone.model
there are 2 options: url
and urlRoot
. What is the purpose and difference between these?
In Backbone.collection
, there is a single parameter url
. Is this always the GET request for the RESTFUL api?