suddenly-api

2.1.1 • Public • Published

Suddenly API Client

CircleCI

A simple API consumer that supports JSON Web Token auth.

Usage

The HTTP methods get, post, put, and delete are supported.

const API = require('suddenly-api');
const api = new API('https://example.com');
 
 
api.get('/things').then((things) => {
    console.log(things);
}).catch((err) => {
    console.log(err);
});
 
 
// Post and Put use a payload
api.post('/things', { name: 'New Thing' }).then((thing) => {
    console.log(thing);
}).catch((err) => {
    console.log(err);
});

Session objects can be set (token is expected if using JSON Web Tokens):

api.setSession({ token: 'encodedtokenstring' });

Readme

Keywords

Package Sidebar

Install

npm i suddenly-api

Weekly Downloads

1

Version

2.1.1

License

ISC

Last publish

Collaborators

  • nathanhoad