This is the documentation for the old GraphQL Yoga version 2. We recommend upgrading to the latest GraphQL Yoga version 5.

Migrate to GraphQL Yoga v5

Integration with Deno

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. But instead of graphql-yoga npm package, we will use @graphql-yoga/common which has an agnostic HTTP handler using Fetch API’s Request and Response objects.


import { serve } from 'https://deno.land/std/http/server.ts'
import { createServer } from 'https://cdn.skypack.dev/@graphql-yoga/common'
const graphQLServer = createServer()
serve(graphQLServer, { port: 4000 })
console.log('Server is running on http://localhost:4000/graphql')

You can also check a full example on our GitHub repository here.