graphql-middleware-bugsnag
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

graphql-middleware-bugsnag

GraphQL Middleware plugin for Bugsnag.

Usage

With GraphQL Yoga

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

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.

Package Sidebar

Install

npm i graphql-middleware-bugsnag

Weekly Downloads

11

Version

1.0.0

License

MIT

Unpacked Size

10.2 kB

Total Files

6

Last publish

Collaborators

  • michieldewilde