@ailo/koa-sentry-middleware

Ailo TypeScript starter

Usage no npm install needed!

<script type="module">
  import ailoKoaSentryMiddleware from 'https://cdn.skypack.dev/@ailo/koa-sentry-middleware';
</script>

README

@ailo/koa-sentry-middleware

Middleware for Koa HTTP server that:

  • configures Sentry scope with Koa HTTP request information,
  • catches errors that happen in Koa request-response cycle,
  • wraps HTTP request-response in a Sentry Transaction.

Usage example

  1. Setup Sentry (@sentry/node and @sentry/apm packages - refer to Sentry docs).

  2. yarn add @ailo/koa-sentry-middleware

  3. import { applyKoaSentryMiddleware } from "@ailo/koa-sentry-middleware";
    import { monitoring } from "./utils/monitoring";
    
    export const app = new Koa();
    applyKoaSentryMiddleware(app, { monitoring });
    

Development

yarn
yarn start

Testing

yarn lint # prettier and eslint
yarn test # unit tests
yarn test:watch # unit tests in watch mode

Releasing

Note: Releasing is done manually (CI isn't configured yet). Linters, tests, build and so on are run during each git push / yarn release.

yarn release # will automatically ask you about version bump, run tests and build, and push new version to git & npm