Add a backend-common package with common concerns such as logging

This commit is contained in:
Fredrik Adelöw
2020-04-29 09:28:50 +02:00
parent a92f662d88
commit 77d48d8794
19 changed files with 722 additions and 13 deletions
+36
View File
@@ -0,0 +1,36 @@
# @backstage/backend-common
Common functionality library for Backstage backends, implementing logging,
error handling and similar.
## Usage
Add the library to your backend package:
```sh
yarn add @backstage/backend-common
```
then make use of the handlers and logger as necessary:
```typescript
import {
logger,
errorHandler,
notFoundHandler,
} from '@backstage/backend-common';
const app = express();
app.use('/home', myHomeRouter);
app.use(errorHandler());
app.use(notFoundHandler());
app.listen(PORT, () => {
logger.info(`Listening on port ${PORT}`);
});
```
## Documentation
- [Backstage Readme](https://github.com/spotify/backstage/blob/master/README.md)
- [Backstage Documentation](https://github.com/spotify/backstage/blob/master/docs/README.md)