1.0.0-beta.0 • Published 7 years ago

bookshelf-fetch-jsonapi v1.0.0-beta.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

bookshelf-jsonapi-query

A Bookshelf plugin to fetch data using JSON API query format.

Installation

$ npm install --save bookshelf-jsonapi-query

Usage

import plugin from 'bookshelf-jsonapi-query';
// Some Bookshelf instantiation code

const q = {
  filter: {
    title: 'Post 1',
  },
};
Bookshelf.plugin(plugin);

Const Posts = Bookshelf.Model.extend({
  ...
});

Posts.fetchJsonapi(q);

The fetchJsonapi takes a query object as its parameter. The query object are most likely constructed by web frameworks such as expressjs from a URL query.