My API server and My website have 2 different URLs !
E.g :
define([
'jquery',
'backbone',
'underscore',
'infrastructure/session/session'],
function($, backbone, _,session){
var Model = backbone.Model.extend({
urlRoot: "api/user/"+session.userIdConnected+"/biometrics/motion/scores",
findFromDate:function (startDate) {
this.fetch({ data: $.param({ from: startDate}) })
},
initialize: function(){
}
});
return Model;
});
Backbone fetch on my website url that is normal because I provided a relative api call url to my model.
Is there somewhere I can set a global url root for all my API calls ?
I think that this link could help you.
with myApp.Settings.DefaultURL global variable which saves the url(s).