0.2.0-alpha.6 • Published 5 years ago

fluxapp-fetch v0.2.0-alpha.6

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Fluxapp 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 fluxapp-fetch

Usage with fluxapp

Hapi

import fetch from 'fluxapp-fetch';

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

jQuery (webpack or browserify)

import fetch from 'fluxapp-fetch';

const context = fluxApp.createContext({
  fetcher: fetch('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.2.0-alpha.6

5 years ago

0.2.0-alpha.5

7 years ago

0.2.0-alpha.4

7 years ago

0.2.0-alpha.3

7 years ago

0.2.0-alpha.2

7 years ago

0.2.0-alpha.1

7 years ago

0.2.0-alpha

7 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago