https://github.com/2wce/graphql-middleware-bugsnag
GraphQL Middleware plugin for Bugsnag
https://github.com/2wce/graphql-middleware-bugsnag
Last synced: about 1 year ago
JSON representation
GraphQL Middleware plugin for Bugsnag
- Host: GitHub
- URL: https://github.com/2wce/graphql-middleware-bugsnag
- Owner: 2wce
- License: mit
- Created: 2019-09-17T07:16:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-11-11T10:56:05.000Z (over 3 years ago)
- Last Synced: 2025-02-01T12:12:12.383Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 424 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# graphql-middleware-bugsnag
> GraphQL Middleware plugin for Bugsnag.
## Usage
> With GraphQL Yoga
```ts
import { GraphQLServer } from 'graphql-yoga'
import { bugsnag } from 'graphql-middleware-bugsnag'
const typeDefs = `
type Query {
hello: String!
bug: String!
}
`
const resolvers = {
Query: {
hello: () => `Hey there!`
bug: () => {
throw new Error(`Many bugs!`)
}
}
}
const bugsnagMiddleware = bugsnag({
apiKey: BUGSNAG_API_KEY
})
const server = GraphQLServer({
typeDefs,
resolvers,
middlewares: [bugsnagMiddleware]
})
serve.start(() => `Server running on http://localhost:4000`)
```
## API & Configuration
```ts
export interface Options {
apiKey: string
forwardErrors?: boolean
}
const bugsnag = (options: Options): IMiddlewareFunction
```
### Options
| property | required | description |
| --------------- | -------- | ------------------------------------------------------------- |
| `apiKey` | true | Your Bugsnag API KEY |
| `forwardErrors` | false | Should middleware forward errors to the client or block them. |
## License
This project is licensed under the [MIT License](LICENSE.md).