@sigfox/universal-api-client

1.0.1 • Public • Published

universal-api-client

Simple promisified http client to send requests

Features

Send http request:

  • POST
  • GET
  • PUT
  • PATCH
  • DELETE
  • HEAD
  • OPTIONS

Install

npm install @sigfox/universal-api-client

Usage

const ApiClient = require('@sigfox/universal-api-client');

const apiClient = new ApiClient({ baseURL: '/api' });

const getData = client => client.get('/data');

const postData = (client, data) => client.post('/data', data);

getData(client).then(response => {
  // use response here
});

postData(client, { lifePurpose: 42 }).then(response => {
  // use response here
});

// and so on...

Test

npm test

Licence

This project is licensed under the MIT License - see the LICENSE file for details.

Readme

Keywords

Package Sidebar

Install

npm i @sigfox/universal-api-client

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

9.43 kB

Total Files

8

Last publish

Collaborators

  • robnriks
  • cgrimal
  • damien-s
  • lbdremy