diff options
| author | netop://ウィビ <paul@webb.page> | 2026-04-26 21:30:43 -0700 |
|---|---|---|
| committer | netop://ウィビ <paul@webb.page> | 2026-04-26 21:30:43 -0700 |
| commit | ab0a791cc0d75efe05ca8b6f9da8e21271fbf309 (patch) | |
| tree | 55ac984ba79be706ee2f83219fc2670bce89f75c /example.ts | |
| parent | 84e0d5ad8ebb8e933823d9dabc8060294a4780dc (diff) | |
| download | gq-ab0a791cc0d75efe05ca8b6f9da8e21271fbf309.tar.gz gq-ab0a791cc0d75efe05ca8b6f9da8e21271fbf309.zip | |
adds awesome new GraphiQL renderer and an example
Diffstat (limited to 'example.ts')
| -rw-r--r-- | example.ts | 29 |
1 files changed, 29 insertions, 0 deletions
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 ***/ |