Files
backstage/packages/backend-common
Tim Hansen 92963779b5 Remove default upgrade-insecure-requests
Co-authored-by: Mike Lewis <mtlewis@users.noreply.github.com>
Co-authored-by: Himanshu Mishra <himanshu@orkohunter.net>
Signed-off-by: Tim Hansen <timbonicus@gmail.com>
2021-06-04 10:20:02 -06:00
..
2021-05-19 16:57:18 +02:00
2021-05-20 11:48:46 +00:00
2021-05-20 11:48:46 +00:00
2021-05-02 22:13:05 +02:00

@backstage/backend-common

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
cd packages/backend
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