# 生命结束插件后端
此后端插件为获取源文件在 生命结束前端插件。 。 。 .
安装
设置您的 integrations 配置
首先,你需要设置你的 integrations 在您的内部配置 app-config.yaml。如果已经设置,您可以跳过此步骤, 如果您需要帮助配置, 您可以读取 综合文献
设置插件
首先,我们需要添加 @dweber019/backstage-plugin-endoflife-backend 软件包 :
# From your Backstage root directory
yarn --cwd packages/backend add @dweber019/backstage-plugin-endoflife-backend
然后我们再创建一个新的文件 packages/backend/src/plugins/endoflife.ts,并添加以下内容:
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,
});
}
接下来我们把它接入整个后端路由器, 编辑 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));
新建后端系统
后端插件有支持 新的后端系统,这里你如何设置:
在你身边 packages/backend/src/index.ts 作如下修改:
const backend = createBackend();
backend.add(import('@dweber019/backstage-plugin-endoflife-backend'));
// ... other feature additions
backend.start();
地方发展
有本地设置 plugins/endoflife-backend/dev 可以从 yarn --cwd plugins/endoflife-backend start 从根起.