Skip to content

Releases: yahoo/fetchr

Module export format changed to Fetchr Class

11 Sep 17:58
Compare
Choose a tag to compare

Breaking changes:

  1. Fetchr now exports the class itself, rather than the class creating factory function.

    var Fetcher = require('fetchr')(), //Fetcher class
        fetcher = new Fetcher(); //Fetcher instance

    now becomes

    var Fetcher = require('fetchr'), //Fetcher class
        fetcher = new Fetcher(); //Fetcher instance
  2. addFetcher method renamed to registerFetcher. This is to keep the api somewhat consistent between fetchr and dispatchr.

  3. Fetcher.middleware() should no longer be mounted directly on the app. It should always be mounted on a path.

    app.use(Fetcher.middleware());

    now becomes

    app.use('/api', Fetcher.middleware());
  4. pathPrefix config option renamed to xhrPath.

    • This config option used to be passed into the class creator function, but is now passed into the class upon instantiation.
    • This option's value should point to the exact path the Fetcher.middleware() was mounted on.

No need to manually swap server/client fetchr file.

03 Sep 21:29
Compare
Choose a tag to compare

We use libs/fetcher.js on the server and libs/fetcher.client.js on the client. Which meant that when require('fetchr') was called we had to grab different files based on the environment(server or client).

This is no longer necessary due to the browser key in package.json where we can explicitly substitute the client file for the server file, and allow users to not worry about this minor detail anymore.

Bugfix for passing in req to data fetchers

28 Aug 17:57
Compare
Choose a tag to compare
  • Fixed a bug where the req object wasn't being passed into data fetchers for GET requests (#11)
  • Config parameter for CRUD calls is now optional (#10)

New Module Export Format

27 Aug 23:19
Compare
Choose a tag to compare

Fetchr now exports a function that returns the Fetchr class. This allows the Fetcher class to be instantiated per each request so that the request object can be passed into the CRUD methods on registered data fetchers (aka API callers).

Fetcher was implemented as a singleton before this breaking change.

var fetchr = require('fetchr')

now becomes

var Fetchr = require('fetchr')();
var fetchr = new Fetchr();