Ext.define('MyApp.data.proxy.CustomRestProxy', {
override: 'Ext.data.proxy.Rest',
buildUrl: function(request) {
//here I simply add an url prefix to all rest calls
var me = this, _serviceUrl = globalConf.serviceUrl, url = me.getUrl(request);
request.setUrl(_serviceUrl + url);
return me.callParent([request]);
}
});
Put this class in a folder according to the name.Mine is located in app/data/proxy/CustomRestProxy.js
In your app.js make sure to set this class as required.
requires: ['MyApp.data.proxy.CustomRestProxy']
When you start your App and Sencha complains it can't find your new class you have to tell Sencha where to look.
Put
Ext.Loader.setPath('MyApp', 'app');
Before you call
Ext.application ...