Interface Changes
#110 - New CRUD interface
We're deprecating the old interface:
fetcher.read('resource', {id: ###}, {}, function (err, data, meta) {
// handle err and/or data returned from data fetcher in this callback
});
in favor of a cleaner, chainable, interface:
fetcher
.read('resource')
.params({id: ###})
.end(function (err, data, meta) {
// handle err and/or data returned from data fetcher in this callback
});
Few things to keep in mind:
- Always start fetcher requests with one of the CRUD (
create
,read
,update
, ordelete
) methods. - Then chain with
params
,body
, orclientConfig
in any order. - Always end requests with the
end
method and provide a callback.
Note: This release does not affect how your data services are defined, it just provides a new way to access your services.