second draft of the Bazaar plugin

signed-off-by: lykkeaxlin <lykkeaxlin@hotmail.com>

Co-authored-by: klaraab <klarabroman@live.se>
Signed-off-by: Lykke Axlin <lykkeaxlin@hotmail.com>
This commit is contained in:
Lykke Axlin
2021-09-14 13:11:18 +02:00
parent 34fa0b3450
commit eb75e42ce7
66 changed files with 7165 additions and 5574 deletions
+49
View File
@@ -0,0 +1,49 @@
# Bazaar Backend
Welcome to the Bazaar backend plugin!
# Installation
## Install the package
```bash
# From your Backstage root directory
cd packages/backend
yarn add @backstage/plugin-bazaar-backend
```
## Adding the plugin to your `packages/backend`
You'll need to add the plugin to the router in your `backend` package. You can do this by creating a file called `packages/backend/src/plugins/bazaar.ts`
```tsx
import { PluginEnvironment } from '../types';
import { createRouter } from '@internal/plugin-bazaar-backend';
export default async function createPlugin({
logger,
database,
config,
}: PluginEnvironment) {
return await createRouter({ logger, config, database });
}
```
With the `bazaar.ts` router setup in place, add the router to `packages/backend/src/index.ts`:
```diff
+ import bazaar from './plugins/bazaar';
async function main() {
...
const createEnv = makeCreateEnv(config);
const catalogEnv = useHotMemoize(module, () => createEnv('catalog'));
+ const bazaarEnv = useHotMemoize(module, () => createEnv('bazaar'));
const apiRouter = Router();
+ apiRouter.use('/bazaar', await bazaar(bazaarEnv));
...
apiRouter.use(notFoundHandler());
```