@kurier/addon-auto-include
TypeScript icon, indicating that this package has built-in type declarations

0.1.0-alpha2 • Public • Published

@kurier/addon-auto-include

A Kurier addon that alters GET operations to automatically include relationships.

Usage

Install it using npm or yarn:

$ npm i -D @kurier/addon-auto-include
$ yarn add -D @kurier/addon-auto-include

Add it to your Kurier app:

import AutoIncludeAddon from "@kurier/addon-auto-include";
// ...
app.use(AutoIncludeAddon);

Apply the addon to any resource relationship by setting the autoInclude flag to true:

import { Resource } from "kurier";
import Designer from "./designer";

export default class Collection extends Resource {
  static schema = {
    attributes: {
      name: String,
      slug: String,
    },
    relationships: {
      designers: {
        type: () => Designer,
        autoInclude: true,
        foreignKeyName: "design_id",
      },
    },
  };
}

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @kurier/addon-auto-include

Weekly Downloads

0

Version

0.1.0-alpha2

License

MIT

Unpacked Size

12.8 kB

Total Files

20

Last publish

Collaborators

  • spersico
  • jaedenalljoor