1.2.0 • Published 5 years ago

@suddenly/api v1.2.0

Weekly downloads
5
License
ISC
Repository
github
Last release
5 years ago

@suddenly-api

A helper for making API calls.

Usage

import API, { queryString } from '@suddenly/api';

const api = new API('app-name', '/api');

api.setSessionToken('SOME SIGNED JWT TOKEN TO AUTH WITH YOUR SERVER');

api.get('/things').then(things => {
  console.log(things);
});

// /things?search=something
api.get('/things' + queryString({ search: 'Something' })).then(things => {
  console.log('things that match Something:', things);
});

api.post('/things', { name: 'New Thing' }).then(thing => {
  console.log(thing);
});

api.put('/things/1', { name: 'Updated Thing' }).then(thing => {
  console.log(thing);
});

api.delete('/things/1').then(thing => {
  console.log(thing);
});

Contributors

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago