@dweber019/backstage-plugin-endoflife-backend
v0.0.12
Published
This backend plugin provides an endpoint for getting source files used in the [End of Life frontend plugin](../endoflife/README.md).
Downloads
1,546
Readme
# End of life Plugin Backend
This backend plugin provides an endpoint for getting source files used in the End of Life frontend plugin.
Install
Setup your integrations
config
First you'll need to setup your integrations
config inside your app-config.yaml
. You can skip this step if it's already setup, and if you need help configuring this you can read the integrations documentation
Setup plugin
First we need to add the @dweber019/backstage-plugin-endoflife-backend
package:
# From your Backstage root directory
yarn --cwd packages/backend add @dweber019/backstage-plugin-endoflife-backend
Then we will create a new file named packages/backend/src/plugins/endoflife.ts
, and add the following to it:
import { createRouter } from '@dweber019/backstage-plugin-endoflife-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
return await createRouter({
reader: env.reader,
cacheClient: env.cache.getClient(),
logger: env.logger,
});
}
Next we wire this into the overall backend router, edit packages/backend/src/index.ts
:
import endOfLife from './plugins/endoflife';
// ...
async function main() {
// ...
// Add this line under the other lines that follow the useHotMemoize pattern
const endOfLifeEnv = useHotMemoize(module, () => createEnv('endoflife'));
// ...
// Insert this line under the other lines that add their routers to apiRouter in the same way
apiRouter.use('/endoflife', await endOfLife(endOfLifeEnv));
New Backend System
The backend plugin has support for the new backend system, here's how you can set that up:
In your packages/backend/src/index.ts
make the following changes:
const backend = createBackend();
backend.add(import('@dweber019/backstage-plugin-endoflife-backend'));
// ... other feature additions
backend.start();
Local development
There is a local setup at plugins/endoflife-backend/dev
which can be started with yarn --cwd plugins/endoflife-backend start
from the root.