js-api-client

1.0.7 • Public • Published

Javascript Api Client

Build Status Coverage Status GitHub license NPM downloads GitHub issues

Javascript api client wrapper around Axios.

Installation

With yarn

yarn add js-api-client

With npm

npm install js-api-client --save

Usage

import ApiClient from 'js-api-client';
 
const client = new ApiClient({
  baseURL: 'https://www.some-api-base-url.com',
});
 
// get
 
const getResponse = client.get('/users/1')
    .then(successHandler)
    .catch(errorHandler);
 
// post
    
const userData = {
    firstName: 'Luis',
    lastName: 'Colon',
};
 
const postResponse = client.post('/users', userData)
    .then(successHandler)
    .catch(errorHandler);
 
// etc
 

/js-api-client/

    Package Sidebar

    Install

    npm i js-api-client

    Weekly Downloads

    1

    Version

    1.0.7

    License

    MIT

    Last publish

    Collaborators

    • luisfcolon