From ba06664de856f36749cfd97e0521771357e4e5ca Mon Sep 17 00:00:00 2001 From: Pedro Salvado Date: Fri, 13 Aug 2021 09:31:32 +0100 Subject: [PATCH] docs: added additional steps and examples to creating custom models - basic example section --- .../headless-cms/content-model-plugins.mdx | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/docs/how-to-guides/webiny-applications/headless-cms/content-model-plugins.mdx b/docs/how-to-guides/webiny-applications/headless-cms/content-model-plugins.mdx index a44576547..2f368efe5 100644 --- a/docs/how-to-guides/webiny-applications/headless-cms/content-model-plugins.mdx +++ b/docs/how-to-guides/webiny-applications/headless-cms/content-model-plugins.mdx @@ -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: