Skip to content

Interface Changes

Compare
Choose a tag to compare
@Vijar Vijar released this 07 Aug 19:02

#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, or delete) methods.
  • Then chain with params, body, or clientConfig 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.