This package has been deprecated

Author message:

Package no longer supported. Use at your own risk.

jsonapi-js

0.4.7 • Public • Published

https://travis-ci.org/lonelyplanet/jsonapi-js

jsonapi-js

A small library for consuming a JsonAPI.

Using it

npm install --save jsonapi-js
import { Resource } from "jsonapi-js";
 
export default class Endpoint extends Resource {
  endpoint = "foo";
}
 
const foo = new Endpoint();
 
foo.findById(1).then(({ model, response }) => {
  // model is a mash of attributes, and all merged relationships from includes
  // resource is the raw response
});
 
foo.find({
  include: ["some-relationship"],
  filter: {
    someKey: "baz"
  }
}).then(({ model, response }) => {
  // model is a mash of attributes, and all merged relationships from includes
  // resource is the raw response
  // model is an array in this case
});

Readme

Keywords

none

Package Sidebar

Install

npm i jsonapi-js

Weekly Downloads

42

Version

0.4.7

License

none

Unpacked Size

531 kB

Total Files

34

Last publish

Collaborators

  • lplabs