@hazejs/graphql
v1.0.0
Published
GraphQL for hazejs: schema-first and code-first schemas, GraphQL over HTTP, GraphiQL, depth / complexity limits, batching loaders and graphql-transport-ws subscriptions
Maintainers
Readme
@hazejs/graphql
GraphQL for hazejs: schema-first (typeDefs + resolvers) or code-first (graphql-js) schemas, GraphQL over HTTP (GET / POST, application/graphql-response+json), GraphiQL, depth and complexity limits, batching loaders, error mapping and graphql-transport-ws subscriptions.
Install
pnpm add @hazejs/graphql graphqlUsage
// app/provider/GraphQLProvider.ts
import { defineSchema, graphqlProvider } from '@hazejs/graphql'
const schema = defineSchema({
typeDefs: `type Query { me: User } type User { id: Int!, name: String! }`,
resolvers: {
Query: {
me: (_, __, ctx) => ctx.auth.user()
},
},
})
// GET / POST /graphql (config/graphql.ts), GraphiQL outside production
export default graphqlProvider(schema)Part of hazejs — see the main README for documentation.
