2022-08-10 00:08:36 +08:00
# Sentry middleware for Hono
2022-08-04 07:54:30 +08:00
2022-08-10 00:08:36 +08:00
Sentry middleware for [Hono ](https://github.com/honojs/hono ).
This middleware sends captured exceptions to the Sentry data source named by the `SENTRY_DSN` environment variable via [toucan-js ](https://github.com/robertcepa/toucan-js ).
2022-08-04 07:54:30 +08:00
## Usage
```ts
2022-08-10 00:08:36 +08:00
import { sentry } from '@honojs/sentry'
2022-08-04 07:54:30 +08:00
import { Hono } from 'hono'
const app = new Hono()
2022-08-10 00:08:36 +08:00
app.use('*', sentry())
2022-08-04 07:54:30 +08:00
app.get('/', (c) => c.text('foo'))
export default app
```
## Deno
```ts
import { serve } from 'https://deno.land/std/http/server.ts'
2022-08-10 00:08:36 +08:00
import { sentry } from 'https://deno.land/x/hono_sentry/mod.ts'
2022-08-04 07:54:30 +08:00
import { Hono } from 'https://deno.land/x/hono/mod.ts'
const app = new Hono()
2022-08-12 11:41:03 +08:00
app.use('*', sentry({ dsn: 'https://xxxxxx@xxx.ingest.sentry.io/xxxxxx' }))
2022-08-04 07:54:30 +08:00
app.get('/', (c) => c.text('foo'))
serve(app.fetch)
```
## Author
Yusuke Wada < https: / / github . com / yusukebe >
## License
MIT