$ npm install --save @reststate/client

@reststate/client needs to be configured with an httpClient object that handles the requests and responses. The easiest way to do this is to provide an axios instance configured with your server's base URL, the standard JSON:API content type, and optionally any authentication info your server requires.

import axios from 'axios';
import { Resource } from '@reststate/client';

const token = ...;

const httpClient = axios.create({
  baseUrl: '',
  headers: {
    'Content-Type': 'application/vnd+api.json',
    'Authentication': `Bearer ${token}`,
const client = new Resource({ name: 'widgets', httpClient });

client.all().then(results => console.log(results));