suddenly-api
2.1.1 • Public • Published Suddenly API Client
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);
});
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' });
Package Sidebar
Install
Weekly Downloads