4.1.1 • Published 11 months ago

@ambassify/fetch-api v4.1.1

Weekly downloads
70
License
MIT
Repository
github
Last release
11 months ago

fetch-api

CircleCI npm version npm downloads maintainer

Small class to create easy to use API clients with fetch. It uses @ambassify/fetch under the hood to provide a default fetch implementation for browser and node.

Usage

Install the package in your project:

npm install --save @ambassify/fetch-api

In your code:

const FetchApi = require('@ambassify/fetch-api');

const api = new FetchApi({
    baseUrl: 'https://your-api.test',
    contentType: 'FORM',
});

api.get('/foo', { offset: 1, limit: 1 })
    .then(res => console.log(res.body))
    .catch(err => console.log(err));

api.post('/foo', { foo: 'bar' });
api.put('/foo/1', { foo: 'bar' });
api.patch('/foo/1', { foo: 'bar' });
api.delete('/foo/1');
4.1.0

11 months ago

4.1.1

11 months ago

4.0.2

11 months ago

4.0.1

1 year ago

4.0.0

2 years ago

3.4.0

3 years ago

3.3.0

4 years ago

3.2.0

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

5 years ago

2.1.0

5 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago