From ab0a791cc0d75efe05ca8b6f9da8e21271fbf309 Mon Sep 17 00:00:00 2001 From: "netop://ウィビ" Date: Sun, 26 Apr 2026 21:30:43 -0700 Subject: adds awesome new GraphiQL renderer and an example --- example.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 example.ts (limited to 'example.ts') diff --git a/example.ts b/example.ts new file mode 100644 index 0000000..9364fe0 --- /dev/null +++ b/example.ts @@ -0,0 +1,29 @@ + + + +/*** UTILITY ------------------------------------------ ***/ + +import { executeSchema, GraphQLHTTP, gql } from "./entry.ts"; + +const schema = executeSchema({ + resolvers: { + Query: { + hello: (_: unknown, { name }: { name?: string }) => `hello, ${name ?? "world"}` + } + }, + typeDefs: gql`type Query { hello(name: String): String }` +}); + +const handler = GraphQLHTTP({ + graphiql: true, + playgroundOptions: { version: "0.4.0" }, + schema +}); + +/*** PROGRAM ------------------------------------------ ***/ + +Deno.serve({ port: 4000 }, handler); + + + +/*** deno run -A example.ts ***/ -- cgit v1.2.3