ConsumerJS is a JavaScript library that provides an ORM-like repository/entity mapper for consuming RESTful JSON APIs, built on top of Axios. The current stable version is 3.2.1. It supports CRUD operations, Django CSRF protection, and can be extended with custom behavior. Unlike raw Axios or fetch, it offers a declarative, object-oriented approach with stateful entity objects and consumer classes that map API endpoints to JavaScript classes. It uses an active release cadence with breaking changes in major versions.
npm install consumerjsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to define a CrudConsumer and CrudConsumerObject for a Post resource, then create and read/update instances.
Use import statements only; avoid require().
Install @babel/polyfill and import it in your entry point.
Import from 'consumerjs' directly.
Run 'npm install axios' alongside consumerjs.
Ensure API response includes either 'id' or 'pk', not conflicting values.
Check @types/consumerjs or use typed wrappers.
Run 'npm install consumerjs' and use 'import { ... } from 'consumerjs''.Use 'import { CrudConsumer } from 'consumerjs'' (named import).Run 'npm install axios'.
Switch to import syntax or use dynamic import().