Skip to content

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

License

Notifications You must be signed in to change notification settings

kurierjs/kurier-addon-auto-include

Repository files navigation

@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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published