Fetchy
Isomorphic data fetcher which works evenly on client and server.
Now fetchy supports only browserify and webpack. Bower support for client side is comming soon.
Requirements
- expressjs
- body-parser — for parsing post request params
- axios — for requesting server-side
- Promise — fetchy uses native promise, so you will probably need to install some Promise polyfill for older browsers
Instalation:
npm i --save fetchy
Usage
Server
var Fetchy = fetchy = ; // then you should register fetchy middleware// by default it handles /_fetchy/:name/:action routesfetchy; // and now you can register data fetcher// it MUST return promisefetchy; // so you can fetch data like thisfetchy;
Client
It's very simillar to server side:
var Fetchy = fetchy = ; // You don't need to register fetcher, you can just make a requestfetchy;
TODO:
- Test client side
- Configuration for route on client side
- Bower support