Docs / Integrations / Integration with Deno Integration with Deno GraphQL Yoga v3 documentation (superseded by v5): GraphQL Yoga provides you a cross-platform GraphQL Server. So you can easily integrate it into any platform besides Node.js.
v5latest v4 v3 v2
This is the documentation for the old GraphQL Yoga v3 We recommend upgrading to the latest GraphQL Yoga v5.
Migrate to GraphQL Yoga v5 .
GraphQL Yoga provides you a cross-platform GraphQL Server. So you can easily integrate it into any
platform besides Node.js.
Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust .
We will use graphql-yoga which has an agnostic HTTP handler using
Fetch API ’s
Request and
Response objects.
Example
Create a import_map.json file.
Learn more about import maps
Create a deno-yoga.ts file:
{
"imports" : {
"graphql-yoga" : "npm:graphql-yoga@^3.7.3"
}
}
import { createSchema, createYoga } from 'graphql-yoga'
import { serve } from 'https://deno.land/std@0.157.0/http/server.ts'
const yoga = createYoga ({
schema: createSchema ({
typeDefs: /* GraphQL */ `
type Query {
hello: String!
}
` ,
resolvers: {
Query: {
hello : () => 'Hello Deno!'
}
}
})
})
serve (yoga, {
onListen ({ hostname , port }) {
console. log ( `Listening on http://${ hostname }:${ port }/${ yoga . graphqlEndpoint }}` )
}
})
And run it:
deno run --allow-net --import-map ./import_map.json index.ts
You can also check a full example on our GitHub repository
here
← Google Cloud Platform Express →