@backstage/backend-common

Common functionality library for Backstage backends

  • Types
  • ESM
  • CJS

This package has been deprecated.

This package is deprecated, please follow the deprecation instructions for the exports you still use

License
Apache-2.0
Install Size
664.3 kB(162.9 MB)
Vulns
14
Published

Get started

$npm install @backstage/backend-common
$pnpm add @backstage/backend-common
$yarn add @backstage/backend-common
$bun add @backstage/backend-common
$deno add npm:@backstage/backend-common
$vlt install @backstage/backend-common
$vp add @backstage/backend-common

Readme

@backstage/backend-common

This package is deprecated and will be removed in a near future, so please follow the deprecated instructions for the exports you still use.

Common functionality library for Backstage backends, implementing logging, error handling and similar.

Usage

Add the library to your backend package:

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

then make use of the handlers and logger as necessary:

import {
  errorHandler,
  getRootLogger,
  notFoundHandler,
  requestLoggingHandler,
} from '@backstage/backend-common';

const app = express();
app.use(requestLoggingHandler());
app.use('/home', myHomeRouter);
app.use(notFoundHandler());
app.use(errorHandler());

app.listen(PORT, () => {
  getRootLogger().info(`Listening on port ${PORT}`);
});

Documentation