0.5.3 • Published 9 years ago

iso-fetch v0.5.3

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

iso-fetch

An isomorphic API proxy, which currently supports jquery on the browser and hapi on the server. This module was created to compliment Fluxapp actions and allow server and client to share the same code base.

Installation

npm install --save iso-fetch

Usage with fluxapp

Hapi

function handler(request, reply) {
  const context = fluxApp.createContext({
      fetcher: isoFetch('hapi', {
        request: request
      })
  });  
}

jQuery (webpack or browserify)

const context = fluxApp.createContext({
  fetcher: isoFetch('jquery')
});  

Using the above it will expose a method on our actions this.context.fetcher(options), for both server side and client side usage.

Supported Options

  • url
  • method
  • headers
  • payload

Writing your own transports

Take a look at the existing Hapi and jQuery implementations. The transport should expose a function that accepts a config object and return a function that accepts an options object.

0.5.3

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.2.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago