foost

0.9.4 • Public • Published

Foost

A simple Fetch API wrapper for the browser. No polyfills, no fallbacks, nothing special, just the minimal code to make your requests a little cleaner and reusable.

Install

npm install foost

Examples

Just a Fetch

const foost = new Foost();

foost.get('https://example.com/things').then(res => {
  console.log('We got some things!');
});

// This body will be JSON stringified on the way out
foost.post('https://example.com/things', {
  name: 'Extra Thing',
  comment: 'Here, take this thing. I have too many.'
});

let form = document.getElementById('form');
let formData = new FormData(form);
// This body will remain a FormData
foost.post('https://example.com/files', formData);

API Communication

const api = new Foost({baseUrl: 'https://example.com'});

api.get('/things');

api.post('/things', {
  name: 'Extra Thing',
  comment: 'Here, take this thing. I have too many.'
});

Dependencies (0)

    Dev Dependencies (5)

    Package Sidebar

    Install

    npm i foost

    Weekly Downloads

    1

    Version

    0.9.4

    License

    MIT

    Unpacked Size

    4.73 kB

    Total Files

    5

    Last publish

    Collaborators

    • slanden1