Integration with Deno
💡
This page is currently under construction and expected to change. Please feel free to reach out to us directly in case you are having any troubles.
GraphQL Mesh 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-mesh/serve-runtime
which has an agnostic HTTP handler using
Fetch API’s
Request
and
Response
objects.
Example
Create a deno.json
file.
Learn more about import maps
Create a deno-mesh.ts
file:
deno.json
{
"imports": {
"@graphql-mesh/serve-runtime": "npm:@graphql-mesh/serve-runtime@^0.1.0"
}
}
deno-mesh.ts
import { serve } from 'https://deno.land/std@0.157.0/http/server.ts'
import { createServeRuntime } from '@graphql-mesh/serve-runtime'
const serveRuntime = createServeRuntime(/* Your configuration */)
serve(mesh, {
onListen({ hostname, port }) {
console.log(`Listening on http://${hostname}:${port}/${mesh.graphqlEndpoint}`)
}
})
And run it:
deno run --allow-net deno-mesh.ts