[![nest badge][nest-badge]](https://nest.land/package/gql)
[![GitHub Workflow Status][gh-actions-img]][github-actions]
[![Codecov][cov-badge]][cov] [![][docs-badge]][docs]
[![][code-quality-img]][code-quality]
# gql
Universal and spec-compliant [GraphQL](https://www.graphql.com/) HTTP middleware
for Deno. Based on [graphql-http](https://github.com/graphql/graphql-http).
## Features
- ✨ Works with `Deno.serve` and [oak](https://github.com/oakserver/oak)
- ⚡
[GraphQL Playground](https://github.com/graphql/graphql-playground/tree/master/packages/graphql-playground-html)
integration (via `graphiql: true`)
## Get started
The simplest setup with `Deno.serve`:
```ts
import { GraphQLHTTP } from 'jsr:@deno-libs/gql@3.0.1/mod.ts'
import { makeExecutableSchema } from 'npm:@graphql-tools/schema@10.0.3'
import { gql } from 'https://deno.land/x/graphql_tag@0.1.2/mod.ts'
const typeDefs = gql`
type Query {
hello: String
}
`
const resolvers = {
Query: {
hello: () => `Hello World!`,
},
}
const schema = makeExecutableSchema({ resolvers, typeDefs })
Deno.serve({
port: 3000,
onListen({ hostname, port }) {
console.log(`☁ Started on http://${hostname}:${port}`)
},
}, async (req) => {
const { pathname } = new URL(req.url)
return pathname === '/graphql'
? await GraphQLHTTP