block by bradoyler 6c908b4413ce2f78aaabff19b7631b0c

Simple Rest API client for node with support for JWT (bearer authentication) - requires Axios

REST-client.js

Usage

const RestClient = require('./rest-client')
const client = RestClient({ baseURL: 'https://mydomain.com' })
client.setAuthHeader('my-auth-token') // optional

const { data } = await client.get('/articles')

Request Debugging

Node:

export DEBUG=rest-client

Browser:

localStorage.debug = 'rest-client'

rest-client.js