A Kurier addon that alters GET operations to automatically include relationships.
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",
},
},
};
}
MIT