unify-mercurius
v1.3.452
Published
[](https://codeclimate.com/github/qlaffont/unify-mercurius/test_coverage) [
const mercurius = require('mercurius')
const { unifyMercuriusErrorFormatter } = require('unify-mercurius')
const app = Fastify()
const schema = `
type Query {
add(x: Int, y: Int): Int
}
`
const resolvers = {
Query: {
add: async (_, { x, y }) => x + y
}
}
app.register(mercurius, {
schema,
resolvers,
errorFormatter: unifyMercuriusErrorFormatter()
})
app.get('/', async function (req, reply) {
const query = '{ add(x: 2, y: 2) }'
return reply.graphql(query)
})
app.listen(3000)
Plugin options
| name | default | description | | ---------------- | ------- | ----------------------------------------------------------------- | | disableDetails | false | If true will remove the originalError key from the error response | | disableLog | false | Disable logging on error |
Tests
To execute jest tests (all errors, type integrity test)
pnpm testMaintain
This package use TSdx. Please check documentation to update this package.
