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).
|
2022-08-22 23:14:46 +08:00
|
|
|
This middleware sends captured exceptions to the specified Sentry data source name via [toucan-js](https://github.com/robertcepa/toucan-js).
|
2022-08-04 07:54:30 +08:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```ts
|
|
|
|
import { Hono } from 'hono'
|
2023-02-04 15:19:47 +08:00
|
|
|
import { sentry } from '@hono/sentry'
|
2022-08-04 07:54:30 +08:00
|
|
|
|
|
|
|
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'
|
2023-02-04 15:08:30 +08:00
|
|
|
import { sentry } from 'npm:@hono/sentry'
|
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
|
|
|
|
|
2022-08-22 23:14:46 +08:00
|
|
|
Samuel Lippert <https://github.com/sam-lippert>
|
2022-08-04 07:54:30 +08:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
MIT
|