diff options
| author | netop://ウィビ <paul@webb.page> | 2026-04-27 13:32:01 -0700 |
|---|---|---|
| committer | netop://ウィビ <paul@webb.page> | 2026-04-27 13:32:01 -0700 |
| commit | ff44a665e9038de183df5ed0467500d697cf3a78 (patch) | |
| tree | be4236fb091f4a2dfc16b4f6de9223c6c526601d /remote-example.ts | |
| parent | ab0a791cc0d75efe05ca8b6f9da8e21271fbf309 (diff) | |
| download | gq-ff44a665e9038de183df5ed0467500d697cf3a78.tar.gz gq-ff44a665e9038de183df5ed0467500d697cf3a78.zip | |
updates example and adds another one for remote testing
Diffstat (limited to '')
| -rw-r--r-- | remote-example.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/remote-example.ts b/remote-example.ts new file mode 100644 index 0000000..e991453 --- /dev/null +++ b/remote-example.ts @@ -0,0 +1,30 @@ + + + +/*** UTILITY ------------------------------------------ ***/ + +// deno-lint-ignore-file no-import-prefix +import { executeSchema, gql, GraphQLHTTP } from "jsr:@eol/gq"; + +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: { title: "Neat GraphQL Server" }, + schema +}); + +/*** PROGRAM ------------------------------------------ ***/ + +Deno.serve({ port: 4000 }, handler); + + + +/*** deno run -A /http/path/to/remote-example.ts ***/ |