diff --git a/.changeset/thirty-timers-repair.md b/.changeset/thirty-timers-repair.md new file mode 100644 index 0000000000..b8e55752e9 --- /dev/null +++ b/.changeset/thirty-timers-repair.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Updated backend plugin template to work better with new backend system diff --git a/docs/plugins/backend-plugin.md b/docs/plugins/backend-plugin.md index 22d4bae371..497a6be9b9 100644 --- a/docs/plugins/backend-plugin.md +++ b/docs/plugins/backend-plugin.md @@ -41,16 +41,16 @@ standalone mode. You can do a first-light test of your service: ```sh cd plugins/carmen-backend -LEGACY_BACKEND_START=true yarn start +yarn start ``` -> Note: `LEGACY_BACKEND_START=true` is needed while we transition fully to the [New Backend System](../backend-system/index.md). The templates have not been migrated yet; you can track this in [issue 21288](https://github.com/backstage/backstage/issues/21288) +> Note: this documentation assumes you are using the latest version of Backstage and the new backend system. If you are not please upgrade and migrate your backend using the [Migration Guide](../backend-system/building-backends/08-migrating.md) This will think for a bit, and then say `Listening on :7007`. In a different terminal window, now run ```sh -curl localhost:7007/carmen/health +curl localhost:7007/api/carmen/health ``` This should return `{"status":"ok"}`. Success! Press `Ctrl + c` to stop it diff --git a/packages/cli/templates/default-backend-plugin/README.md.hbs b/packages/cli/templates/default-backend-plugin/README.md.hbs index 5c34b40360..e95c626167 100644 --- a/packages/cli/templates/default-backend-plugin/README.md.hbs +++ b/packages/cli/templates/default-backend-plugin/README.md.hbs @@ -7,7 +7,7 @@ _This plugin was created through the Backstage CLI_ ## Getting started Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn -start` in the root directory, and then navigating to [/{{id}}](http://localhost:3000/{{id}}). +start` in the root directory, and then navigating to [/{{pluginVar}}/health](http://localhost:7007/api/{{pluginVar}}/health). You can also serve the plugin in isolation by running `yarn start` in the plugin directory. This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. diff --git a/packages/cli/templates/default-backend-plugin/src/plugin.ts.hbs b/packages/cli/templates/default-backend-plugin/src/plugin.ts.hbs index cdc30b561b..c631f1df0d 100644 --- a/packages/cli/templates/default-backend-plugin/src/plugin.ts.hbs +++ b/packages/cli/templates/default-backend-plugin/src/plugin.ts.hbs @@ -26,6 +26,10 @@ export const {{pluginVar}} = createBackendPlugin({ logger, }), ); + httpRouter.addAuthPolicy({ + path: '/health', + allow: 'unauthenticated', + }); }, }); },