JSPM

@backstage/backend-common

0.0.0-nightly-20201017299
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 124690
  • Score
    100M100P100Q17405F
  • License Apache-2.0

Common functionality library for Backstage backends

Package Exports

  • @backstage/backend-common

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@backstage/backend-common) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@backstage/backend-common

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

Usage

Add the library to your backend package:

yarn 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