Add Toucan boilerplate

pull/31/head
Samuel Lippert 2022-08-03 18:29:03 -05:00
parent 2222f73280
commit f7c2dfdbb3
No known key found for this signature in database
GPG Key ID: 3762857AF8948B2C
1 changed files with 13 additions and 1 deletions

View File

@ -1,7 +1,19 @@
import type { Handler } from 'hono'
import Toucan from 'toucan-js'
export const hello = (): Handler => {
return async (c, next) => {
await next()
const sentry = new Toucan({
dsn: c.env.SENTRY_DSN,
request: c.req,
allowedHeaders: ['user-agent'],
allowedSearchParams: /(.*)/,
})
try {
await next()
} catch (error) {
sentry.captureException(error)
}
}
}