Skip to main content
Deno 2 is finally here 🎉️
Learn more

graphql_tools

Deno port of graphql-tools library. Code is extracted from oak_graphql.

Example

import { serve } from 'https://deno.land/std/http/mod.ts'
import { makeExecutableSchema } from 'https://deno.land/graphql_tools/mod.ts'
import { GraphQLHTTP } from 'https://deno.land/x/gql/mod.ts'
import { gql } from 'https://deno.land/x/graphql_tag/mod.ts'

const typeDefs = gql`
  type Query {
    hello: String
  }
`

const resolvers = {
  Query: {
    hello: () => `Hello World!`
  }
}

const schema = makeExecutableSchema({ typeDefs, resolvers })

const app = GraphQLHTTP({ schema, graphiql: true })

const s = serve({ port: 3000 })

for await (const req of s) {
  app(req)
}