Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 832 Bytes

File metadata and controls

53 lines (35 loc) · 832 Bytes

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.