@backstage/plugin-app-backend
TypeScript icon, indicating that this package has built-in type declarations

0.5.1 • Public • Published

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

# From your Backstage root directory
yarn --cwd packages/backend add @backstage/plugin-app-backend app

By adding the app package as a dependency we ensure that it is built as part of the backend, and that it can be resolved at runtime.

Now add the plugin to your app, creating it for example like this:

New Backend

import { createBackend } from '@backstage/backend-defaults';

const backend = createBackend();
backend.add(import('@backstage/plugin-app-backend'));
backend.start();

Old Backend

const router = await createRouter({
  logger: env.logger,
  appPackageName: 'example-app',
});

And registering it like this:

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.

/@backstage/plugin-app-backend/

    Package Sidebar

    Install

    npm i @backstage/plugin-app-backend

    Homepage

    backstage.io

    Weekly Downloads

    44,422

    Version

    0.5.1

    License

    Apache-2.0

    Unpacked Size

    138 kB

    Total Files

    29

    Last publish

    Collaborators

    • patriko
    • freben
    • marcuseide