From 5cc4c55e3899b54dfa263f56c06df9e6d882ed02 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 17 Aug 2020 13:20:25 +0200 Subject: [PATCH] plugins/app-backend: add installation instructions --- plugins/app-backend/README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/plugins/app-backend/README.md b/plugins/app-backend/README.md index 28480b81a1..5d290093d7 100644 --- a/plugins/app-backend/README.md +++ b/plugins/app-backend/README.md @@ -1,3 +1,32 @@ # App backend plugin This backend plugin can be installed to serve static content of a Backstage app. + +## Installation + +Add both this package and your local frontend app package as dependencies to your backend, for example + +```bash +yarn add @backstage/plugin-app-backend example-app +``` + +By adding the app package as a dependency we ensure that it is build as part of the backend, and that it can be resolved at runtime. + +Now add the plugin router to your app, creating it for example like this: + +```ts +const router = await createRouter({ + logger, + appPackageName: 'example-app', +}); +``` + +And registering it like this: + +```ts +createServiceBuilder(module) + ... + .addRouter('', router); +``` + +Be sure to register the app router last, as it serves content for HTML5-mode navigation, i.e. falling back to serving `index.html` for any route that can't be found.