Skip to main content

Graphql (yoga)

Handle graphql with yoga.

Import

Deno

import {...} from "https://deno.land/x/nhttp@1.3.26/lib/yoga.ts";

Deno npm

import {...} from "npm:nhttp-land@1.3.26/yoga";

Node / Bun

import {...} from "nhttp-land/yoga";
// or
// const {...} = require("nhttp-land/yoga");

Usage

import nhttp from "https://deno.land/x/nhttp@1.3.26/mod.ts";
import yogaHandler from "https://deno.land/x/nhttp@1.3.26/lib/yoga.ts";
import { createSchema, createYoga } from "npm:graphql-yoga";

const yoga = createYoga({
schema: createSchema({...}),
});

const app = nhttp();

app.any("/graphql", yogaHandler(yoga));

app.listen(8000);