Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: added additional steps and examples to creating custom models - basic example section #332

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,33 @@ export default [
];
```

:::info
Do note that you will also need to import the newly created [`api/code/headlessCMS/src/plugins/models.ts`](https://github.com/webiny/webiny-examples/blob/master/headless-cms/content-model-plugins/basic/api/code/headlessCMS/src/plugins/models.ts) file and register the created plugins in the [`api/code/headlessCMS/src/index.ts`](https://github.com/webiny/webiny-examples/blob/master/headless-cms/content-model-plugins/basic/api/code/headlessCMS/src/index.ts#L42) entrypoint file.
:::
Now head to [`api/code/headlessCMS/src/index.ts`](https://github.com/webiny/webiny-examples/blob/master/headless-cms/content-model-plugins/basic/api/code/headlessCMS/src/index.ts#L42) and register the new plugins.

```ts title="api/code/headlessCMS/src/index.ts"
...

// Importing custom plugins
import customModels from "./plugins/models"

...

export const handler = createHandler({
plugins: [
...
customModels
],
http: { debug }
});

```

Finally don't forget to redeploy the headlessCMS app, by running (change then ``env`` value accordingly):

```console
yarn webiny deploy api/headlessCMS --env dev
```

Once registered, we should end up with the following two items in our Admin Area main menu:
Once registered and deployed, we should end up with the following two items in our Admin Area main menu:

<CenteredImage
alt="Product and E-Commerce Items in the Admin Area Main Menu"
Expand Down